From: Namjae Jeon namjae.jeon@samsung.com
mainline inclusion from mainline-5.15-rc1 commit d710f37c7bcd7f2cedab4762fff3e11c83aebf3f category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I60T7G CVE: NA
Reference: https://git.kernel.org/torvalds/linux/c/d710f37c7bcd
-------------------------------
smack inherit was added for internal product beofre. It is no longer used. This patch remove it's left overs.
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/ksmbd_server.h | 9 ++++----- fs/cifsd/vfs.c | 42 ----------------------------------------- 2 files changed, 4 insertions(+), 47 deletions(-)
diff --git a/fs/cifsd/ksmbd_server.h b/fs/cifsd/ksmbd_server.h index c5181a2702ff..e46be4084087 100644 --- a/fs/cifsd/ksmbd_server.h +++ b/fs/cifsd/ksmbd_server.h @@ -224,11 +224,10 @@ enum KSMBD_TREE_CONN_STATUS { #define KSMBD_SHARE_FLAG_OPLOCKS BIT(7) #define KSMBD_SHARE_FLAG_PIPE BIT(8) #define KSMBD_SHARE_FLAG_HIDE_DOT_FILES BIT(9) -#define KSMBD_SHARE_FLAG_INHERIT_SMACK BIT(10) -#define KSMBD_SHARE_FLAG_INHERIT_OWNER BIT(11) -#define KSMBD_SHARE_FLAG_STREAMS BIT(12) -#define KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS BIT(13) -#define KSMBD_SHARE_FLAG_ACL_XATTR BIT(14) +#define KSMBD_SHARE_FLAG_INHERIT_OWNER BIT(10) +#define KSMBD_SHARE_FLAG_STREAMS BIT(11) +#define KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS BIT(12) +#define KSMBD_SHARE_FLAG_ACL_XATTR BIT(13)
/* * Tree connect request flags. diff --git a/fs/cifsd/vfs.c b/fs/cifsd/vfs.c index 264f8932d40f..0ecdb5121c3a 100644 --- a/fs/cifsd/vfs.c +++ b/fs/cifsd/vfs.c @@ -69,46 +69,6 @@ static void ksmbd_vfs_inherit_owner(struct ksmbd_work *work, i_uid_write(inode, i_uid_read(parent_inode)); }
-static void ksmbd_vfs_inherit_smack(struct ksmbd_work *work, - struct dentry *dir_dentry, struct dentry *dentry) -{ - char *name, *xattr_list = NULL, *smack_buf; - int value_len, xattr_list_len; - - if (!test_share_config_flag(work->tcon->share_conf, - KSMBD_SHARE_FLAG_INHERIT_SMACK)) - return; - - xattr_list_len = ksmbd_vfs_listxattr(dir_dentry, &xattr_list); - if (xattr_list_len < 0) { - goto out; - } else if (!xattr_list_len) { - ksmbd_err("no ea data in the file\n"); - return; - } - - for (name = xattr_list; name - xattr_list < xattr_list_len; - name += strlen(name) + 1) { - int rc; - - ksmbd_debug(VFS, "%s, len %zd\n", name, strlen(name)); - if (strcmp(name, XATTR_NAME_SMACK)) - continue; - - value_len = ksmbd_vfs_getxattr(dir_dentry, name, &smack_buf); - if (value_len <= 0) - continue; - - rc = ksmbd_vfs_setxattr(dentry, XATTR_NAME_SMACK, smack_buf, - value_len, 0); - ksmbd_free(smack_buf); - if (rc < 0) - ksmbd_err("ksmbd_vfs_setxattr() failed: %d\n", rc); - } -out: - ksmbd_vfs_xattr_free(xattr_list); -} - int ksmbd_vfs_inode_permission(struct dentry *dentry, int acc_mode, bool delete) { int mask; @@ -198,7 +158,6 @@ int ksmbd_vfs_create(struct ksmbd_work *work, const char *name, umode_t mode) if (!err) { ksmbd_vfs_inherit_owner(work, d_inode(path.dentry), d_inode(dentry)); - ksmbd_vfs_inherit_smack(work, path.dentry, dentry); } else { ksmbd_err("File(%s): creation failed (err:%d)\n", name, err); } @@ -234,7 +193,6 @@ int ksmbd_vfs_mkdir(struct ksmbd_work *work, const char *name, umode_t mode) if (!err) { ksmbd_vfs_inherit_owner(work, d_inode(path.dentry), d_inode(dentry)); - ksmbd_vfs_inherit_smack(work, path.dentry, dentry); } else { ksmbd_err("mkdir(%s): creation failed (err:%d)\n", name, err); }