diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-27 11:06:05 -0400 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2019-01-29 11:25:42 +0900 |
commit | f4a3eed1d19d4f1421105384c4efa9ffab9a503b (patch) | |
tree | 2589a7e77187f2ce00cd722ac2ab65aa9d2214df /mm | |
parent | 0ef983afec0191daaf9111c571e825c7049de5d2 (diff) | |
download | linux-artik7-f4a3eed1d19d4f1421105384c4efa9ffab9a503b.tar.gz linux-artik7-f4a3eed1d19d4f1421105384c4efa9ffab9a503b.tar.bz2 linux-artik7-f4a3eed1d19d4f1421105384c4efa9ffab9a503b.zip |
switch ->setxattr() to passing dentry and inode separately
commit 3767e255b390d72f9a33c08d9e86c5f21f25860f upstream.
smack ->d_instantiate() uses ->setxattr(), so to be able to call it before
we'd hashed the new dentry and attached it to inode, we need ->setxattr()
instances getting the inode as an explicit argument rather than obtaining
it from dentry.
Similar change for ->getxattr() had been done in commit ce23e64. Unlike
->getxattr() (which is used by both selinux and smack instances of
->d_instantiate()) ->setxattr() is used only by smack one and unfortunately
it got missed back then.
Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Tested-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[sw0312.kim: backport from mainline to resolve setxattr crash on smack]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I4bf991924e16f61746453b7fd096e5d59438659b
Diffstat (limited to 'mm')
-rw-r--r-- | mm/shmem.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index f03c71f268bb..b6e188c07426 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2603,10 +2603,11 @@ static ssize_t shmem_getxattr(struct dentry *dentry, struct inode *inode, return simple_xattr_get(&info->xattrs, name, buffer, size); } -static int shmem_setxattr(struct dentry *dentry, const char *name, - const void *value, size_t size, int flags) +static int shmem_setxattr(struct dentry *dentry, struct inode *inode, + const char *name, const void *value, size_t size, + int flags) { - struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); + struct shmem_inode_info *info = SHMEM_I(inode); int err; /* @@ -2615,7 +2616,8 @@ static int shmem_setxattr(struct dentry *dentry, const char *name, * for it via sb->s_xattr. */ if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) - return generic_setxattr(dentry, name, value, size, flags); + return generic_setxattr(dentry, inode, name, value, size, + flags); err = shmem_xattr_validate(name); if (err) |