From: Namjae Jeon namjae.jeon@samsung.com
mainline inclusion from mainline-5.15-rc1 commit fba08fa005e44b18d6956de3abbe104f45e74697 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I60T7G CVE: NA
Reference: https://git.kernel.org/torvalds/linux/c/fba08fa005e4
-------------------------------
Use d_inode().
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 | 4 ++-- fs/cifsd/smbacl.c | 6 +++--- fs/cifsd/vfs.c | 10 +++++----- fs/cifsd/vfs_cache.h | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/fs/cifsd/smb2pdu.c b/fs/cifsd/smb2pdu.c index ba552b8f2127..7d6013ea23e7 100644 --- a/fs/cifsd/smb2pdu.c +++ b/fs/cifsd/smb2pdu.c @@ -2890,9 +2890,9 @@ int smb2_open(struct ksmbd_work *work) /* Set default windows and posix acls if creating new file */ if (created) { int posix_acl_rc; - struct inode *inode = path.dentry->d_inode; + struct inode *inode = d_inode(path.dentry);
- posix_acl_rc = ksmbd_vfs_inherit_posix_acl(inode, path.dentry->d_parent->d_inode); + posix_acl_rc = ksmbd_vfs_inherit_posix_acl(inode, d_inode(path.dentry->d_parent)); if (posix_acl_rc) ksmbd_debug(SMB, "inherit posix acl failed : %d\n", posix_acl_rc);
diff --git a/fs/cifsd/smbacl.c b/fs/cifsd/smbacl.c index a3675aa837b9..d65e853ab00f 100644 --- a/fs/cifsd/smbacl.c +++ b/fs/cifsd/smbacl.c @@ -950,7 +950,7 @@ int smb_inherit_dacl(struct ksmbd_conn *conn, struct dentry *dentry, int inherited_flags = 0, flags = 0, i, ace_cnt = 0, nt_size = 0; int rc = -ENOENT, num_aces, dacloffset, pntsd_type, acl_len; char *aces_base; - bool is_dir = S_ISDIR(dentry->d_inode->i_mode); + bool is_dir = S_ISDIR(d_inode(dentry)->i_mode);
acl_len = ksmbd_vfs_get_sd_xattr(conn, parent, &parent_pntsd); if (acl_len <= 0) @@ -1198,7 +1198,7 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, struct dentry *dentry, granted = GENERIC_ALL_FLAGS; }
- posix_acls = ksmbd_vfs_get_acl(dentry->d_inode, ACL_TYPE_ACCESS); + posix_acls = ksmbd_vfs_get_acl(d_inode(dentry), ACL_TYPE_ACCESS); if (posix_acls && !found) { unsigned int id = -1;
@@ -1263,7 +1263,7 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon, { int rc; struct smb_fattr fattr = {{0}}; - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry);
fattr.cf_uid = INVALID_UID; fattr.cf_gid = INVALID_GID; diff --git a/fs/cifsd/vfs.c b/fs/cifsd/vfs.c index 7c8ab19ab014..29f31db4e07e 100644 --- a/fs/cifsd/vfs.c +++ b/fs/cifsd/vfs.c @@ -1461,11 +1461,11 @@ int ksmbd_vfs_set_sd_xattr(struct ksmbd_conn *conn, struct dentry *dentry, struct ndr sd_ndr = {0}, acl_ndr = {0}; struct xattr_ntacl acl = {0}; struct xattr_smb_acl *smb_acl, *def_smb_acl = NULL; - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry);
acl.version = 4; acl.hash_type = XATTR_SD_HASH_TYPE_SHA256; - acl.current_time = ksmbd_UnixTimeToNT(current_time(dentry->d_inode)); + acl.current_time = ksmbd_UnixTimeToNT(current_time(inode));
memcpy(acl.desc, "posix_acl", 9); acl.desc_len = 10; @@ -1486,9 +1486,9 @@ int ksmbd_vfs_set_sd_xattr(struct ksmbd_conn *conn, struct dentry *dentry, return rc; }
- smb_acl = ksmbd_vfs_make_xattr_posix_acl(dentry->d_inode, ACL_TYPE_ACCESS); + smb_acl = ksmbd_vfs_make_xattr_posix_acl(inode, ACL_TYPE_ACCESS); if (S_ISDIR(inode->i_mode)) - def_smb_acl = ksmbd_vfs_make_xattr_posix_acl(dentry->d_inode, + def_smb_acl = ksmbd_vfs_make_xattr_posix_acl(inode, ACL_TYPE_DEFAULT);
rc = ndr_encode_posix_acl(&acl_ndr, inode, smb_acl, def_smb_acl); @@ -1531,7 +1531,7 @@ int ksmbd_vfs_get_sd_xattr(struct ksmbd_conn *conn, struct dentry *dentry,
rc = ksmbd_vfs_getxattr(dentry, XATTR_NAME_SD, &n.data); if (rc > 0) { - struct inode *inode = dentry->d_inode; + struct inode *inode = d_inode(dentry); struct ndr acl_ndr = {0}; struct xattr_ntacl acl; struct xattr_smb_acl *smb_acl = NULL, *def_smb_acl = NULL; diff --git a/fs/cifsd/vfs_cache.h b/fs/cifsd/vfs_cache.h index 8226fdf882e4..ce2047dda36a 100644 --- a/fs/cifsd/vfs_cache.h +++ b/fs/cifsd/vfs_cache.h @@ -26,8 +26,8 @@ #define SMB2_NO_FID (0xFFFFFFFFFFFFFFFFULL)
#define FP_FILENAME(fp) fp->filp->f_path.dentry->d_name.name -#define FP_INODE(fp) fp->filp->f_path.dentry->d_inode -#define PARENT_INODE(fp) fp->filp->f_path.dentry->d_parent->d_inode +#define FP_INODE(fp) d_inode(fp->filp->f_path.dentry) +#define PARENT_INODE(fp) d_inode(fp->filp->f_path.dentry->d_parent)
#define ATTR_FP(fp) (fp->attrib_only && \ (fp->cdoption != FILE_OVERWRITE_IF_LE && \