@@ -58,18 +58,18 @@ static void __wbuf(struct ksmbd_work *work, void **req, void **rsp)
5858 *
5959 * Return: 1 if valid session id, otherwise 0
6060 */
61- static inline int check_session_id (struct ksmbd_conn * conn , u64 id )
61+ static inline bool check_session_id (struct ksmbd_conn * conn , u64 id )
6262{
6363 struct ksmbd_session * sess ;
6464
6565 if (id == 0 || id == -1 )
66- return 0 ;
66+ return false ;
6767
6868 sess = ksmbd_session_lookup_all (conn , id );
6969 if (sess )
70- return 1 ;
70+ return true ;
7171 pr_err ("Invalid user session id: %llu\n" , id );
72- return 0 ;
72+ return false ;
7373}
7474
7575struct channel * lookup_chann_list (struct ksmbd_session * sess , struct ksmbd_conn * conn )
@@ -85,10 +85,11 @@ struct channel *lookup_chann_list(struct ksmbd_session *sess, struct ksmbd_conn
8585}
8686
8787/**
88- * smb2_get_ksmbd_tcon() - get tree connection information for a tree id
88+ * smb2_get_ksmbd_tcon() - get tree connection information using a tree id.
8989 * @work: smb work
9090 *
91- * Return: matching tree connection on success, otherwise error
91+ * Return: 0 if there is a tree connection matched or these are
92+ * skipable commands, otherwise error
9293 */
9394int smb2_get_ksmbd_tcon (struct ksmbd_work * work )
9495{
@@ -105,14 +106,14 @@ int smb2_get_ksmbd_tcon(struct ksmbd_work *work)
105106
106107 if (xa_empty (& work -> sess -> tree_conns )) {
107108 ksmbd_debug (SMB , "NO tree connected\n" );
108- return -1 ;
109+ return - ENOENT ;
109110 }
110111
111112 tree_id = le32_to_cpu (req_hdr -> Id .SyncId .TreeId );
112113 work -> tcon = ksmbd_tree_conn_lookup (work -> sess , tree_id );
113114 if (!work -> tcon ) {
114115 pr_err ("Invalid tid %d\n" , tree_id );
115- return -1 ;
116+ return - EINVAL ;
116117 }
117118
118119 return 1 ;
@@ -145,45 +146,45 @@ void smb2_set_err_rsp(struct ksmbd_work *work)
145146 * is_smb2_neg_cmd() - is it smb2 negotiation command
146147 * @work: smb work containing smb header
147148 *
148- * Return: 1 if smb2 negotiation command, otherwise 0
149+ * Return: true if smb2 negotiation command, otherwise false
149150 */
150- int is_smb2_neg_cmd (struct ksmbd_work * work )
151+ bool is_smb2_neg_cmd (struct ksmbd_work * work )
151152{
152153 struct smb2_hdr * hdr = work -> request_buf ;
153154
154155 /* is it SMB2 header ? */
155156 if (hdr -> ProtocolId != SMB2_PROTO_NUMBER )
156- return 0 ;
157+ return false ;
157158
158159 /* make sure it is request not response message */
159160 if (hdr -> Flags & SMB2_FLAGS_SERVER_TO_REDIR )
160- return 0 ;
161+ return false ;
161162
162163 if (hdr -> Command != SMB2_NEGOTIATE )
163- return 0 ;
164+ return false ;
164165
165- return 1 ;
166+ return true ;
166167}
167168
168169/**
169170 * is_smb2_rsp() - is it smb2 response
170171 * @work: smb work containing smb response buffer
171172 *
172- * Return: 1 if smb2 response, otherwise 0
173+ * Return: true if smb2 response, otherwise false
173174 */
174- int is_smb2_rsp (struct ksmbd_work * work )
175+ bool is_smb2_rsp (struct ksmbd_work * work )
175176{
176177 struct smb2_hdr * hdr = work -> response_buf ;
177178
178179 /* is it SMB2 header ? */
179180 if (hdr -> ProtocolId != SMB2_PROTO_NUMBER )
180- return 0 ;
181+ return false ;
181182
182183 /* make sure it is response not request message */
183184 if (!(hdr -> Flags & SMB2_FLAGS_SERVER_TO_REDIR ))
184- return 0 ;
185+ return false ;
185186
186- return 1 ;
187+ return true ;
187188}
188189
189190/**
@@ -2385,11 +2386,14 @@ static void ksmbd_acls_fattr(struct smb_fattr *fattr, struct inode *inode)
23852386 fattr -> cf_uid = inode -> i_uid ;
23862387 fattr -> cf_gid = inode -> i_gid ;
23872388 fattr -> cf_mode = inode -> i_mode ;
2389+ fattr -> cf_acls = NULL ;
23882390 fattr -> cf_dacls = NULL ;
23892391
2390- fattr -> cf_acls = get_acl (inode , ACL_TYPE_ACCESS );
2391- if (S_ISDIR (inode -> i_mode ))
2392- fattr -> cf_dacls = get_acl (inode , ACL_TYPE_DEFAULT );
2392+ if (IS_ENABLED (CONFIG_FS_POSIX_ACL )) {
2393+ fattr -> cf_acls = get_acl (inode , ACL_TYPE_ACCESS );
2394+ if (S_ISDIR (inode -> i_mode ))
2395+ fattr -> cf_dacls = get_acl (inode , ACL_TYPE_DEFAULT );
2396+ }
23932397}
23942398
23952399/**
@@ -8291,7 +8295,7 @@ int smb3_encrypt_resp(struct ksmbd_work *work)
82918295 return rc ;
82928296}
82938297
8294- int smb3_is_transform_hdr (void * buf )
8298+ bool smb3_is_transform_hdr (void * buf )
82958299{
82968300 struct smb2_transform_hdr * trhdr = buf ;
82978301
0 commit comments