From: Namjae Jeon namjae.jeon@samsung.com
mainline inclusion from mainline-5.15-rc1 commit 3d47e54623897020e996b952bdf3ed9df447b5bf category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I60T7G CVE: NA
Reference: https://git.kernel.org/torvalds/linux/c/3d47e5462389
-------------------------------
WARNING: Too many leading tabs - consider code refactoring 3066: FILE: fs/cifsd/smb2pdu.c:2733: + if (fattr.cf_dacls)
Fix a warning from checkpatch.pl.
Signed-off-by: Namjae Jeon namjae.jeon@samsung.com Signed-off-by: Steve French stfrench@microsoft.com Signed-off-by: Jason Yan yanaijie@huawei.com Signed-off-by: Zhong Jinghua zhongjinghua@huawei.com --- fs/cifsd/smb2pdu.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-)
diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c index a18792ce96be..18576148f530 100644 --- a/fs/cifsd/smb2pdu.c +++ b/fs/cifsd/smb2pdu.c @@ -2250,6 +2250,19 @@ static int smb2_create_sd_buffer(struct ksmbd_work *work, return rc; }
+ +static void ksmbd_acls_fattr(struct smb_fattr *fattr, struct inode *inode) +{ + fattr->cf_uid = inode->i_uid; + fattr->cf_gid = inode->i_gid; + fattr->cf_mode = inode->i_mode; + fattr->cf_dacls = NULL; + + fattr->cf_acls = ksmbd_vfs_get_acl(inode, ACL_TYPE_ACCESS); + if (S_ISDIR(inode->i_mode)) + fattr->cf_dacls = ksmbd_vfs_get_acl(inode, ACL_TYPE_DEFAULT); +} + /** * smb2_open() - handler for smb file open request * @work: smb work containing request buffer @@ -2734,23 +2747,13 @@ int smb2_open(struct ksmbd_work *work) KSMBD_SHARE_FLAG_ACL_XATTR)) { struct smb_fattr fattr; struct smb_ntsd *pntsd; - int pntsd_size, ace_num; - - fattr.cf_uid = inode->i_uid; - fattr.cf_gid = inode->i_gid; - fattr.cf_mode = inode->i_mode; - fattr.cf_dacls = NULL; - ace_num = 0; + int pntsd_size, ace_num = 0;
- fattr.cf_acls = ksmbd_vfs_get_acl(inode, ACL_TYPE_ACCESS); + ksmbd_acls_fattr(&fattr, inode); if (fattr.cf_acls) ace_num = fattr.cf_acls->a_count; - if (S_ISDIR(inode->i_mode)) { - fattr.cf_dacls = - ksmbd_vfs_get_acl(inode, ACL_TYPE_DEFAULT); - if (fattr.cf_dacls) - ace_num += fattr.cf_dacls->a_count; - } + if (fattr.cf_dacls) + ace_num += fattr.cf_dacls->a_count;
pntsd = kmalloc(sizeof(struct smb_ntsd) + sizeof(struct smb_sid) * 3 + @@ -2768,6 +2771,7 @@ int smb2_open(struct ksmbd_work *work)
rc = ksmbd_vfs_set_sd_xattr(conn, path.dentry, pntsd, pntsd_size); + kfree(pntsd); if (rc) ksmbd_err("failed to store ntacl in xattr : %d\n", rc); @@ -4847,14 +4851,7 @@ static int smb2_get_info_sec(struct ksmbd_work *work, return -ENOENT;
inode = FP_INODE(fp); - fattr.cf_uid = inode->i_uid; - fattr.cf_gid = inode->i_gid; - fattr.cf_mode = inode->i_mode; - fattr.cf_dacls = NULL; - - fattr.cf_acls = ksmbd_vfs_get_acl(inode, ACL_TYPE_ACCESS); - if (S_ISDIR(inode->i_mode)) - fattr.cf_dacls = ksmbd_vfs_get_acl(inode, ACL_TYPE_DEFAULT); + ksmbd_acls_fattr(&fattr, inode);
if (test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_ACL_XATTR))