From: Daniel Roseberg Date: Tue, 9 May 2017 20:36:35 +0000 (-0700) Subject: ANDROID: sdcardfs: Don't iput if we didn't igrab X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=228f1c7f4e6836be91ebe7feb3fffb41577dd628;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ANDROID: sdcardfs: Don't iput if we didn't igrab If we fail to get top, top is either NULL, or igrab found that we're in the process of freeing that inode, and did not grab it. Either way, we didn't grab it, and have no business putting it. Signed-off-by: Daniel Rosenberg Bug: 38117720 Change-Id: Ie2f587483b9abb5144263156a443e89bc69b767b --- diff --git a/fs/sdcardfs/inode.c b/fs/sdcardfs/inode.c index 97120e85e31c..1beda0c7772b 100644 --- a/fs/sdcardfs/inode.c +++ b/fs/sdcardfs/inode.c @@ -625,11 +625,8 @@ static int sdcardfs_permission(struct vfsmount *mnt, struct inode *inode, int ma if (IS_ERR(mnt)) return PTR_ERR(mnt); - if (!top) { - release_top(SDCARDFS_I(inode)); - WARN(1, "Top value was null!\n"); + if (!top) return -EINVAL; - } /* * Permission check on sdcardfs inode. @@ -704,10 +701,8 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct inode = d_inode(dentry); top = grab_top(SDCARDFS_I(inode)); - if (!top) { - release_top(SDCARDFS_I(inode)); + if (!top) return -EINVAL; - } /* * Permission check on sdcardfs inode.