diff options
author | Daniel Roseberg <drosen@google.com> | 2017-05-09 13:36:35 -0700 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2017-07-17 10:27:40 +0530 |
commit | 3e637f02151b74641a7920cdf1c1a4ba4f6b9e97 (patch) | |
tree | 415e570c510502640e4abd22ec5b6fbb527bab94 | |
parent | 5ba3acb272f5191076a7d89882670156b49b1db2 (diff) | |
download | linaro-android-3e637f02151b74641a7920cdf1c1a4ba4f6b9e97.tar.gz |
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 <drosen@google.com>
Bug: 38117720
Change-Id: Ie2f587483b9abb5144263156a443e89bc69b767b
-rw-r--r-- | fs/sdcardfs/inode.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/sdcardfs/inode.c b/fs/sdcardfs/inode.c index 92afceb4fc65..4d558b87fe42 100644 --- a/fs/sdcardfs/inode.c +++ b/fs/sdcardfs/inode.c @@ -622,11 +622,8 @@ static int sdcardfs_permission(struct vfsmount *mnt, struct inode *inode, int ma struct inode tmp; struct inode *top = grab_top(SDCARDFS_I(inode)); - if (!top) { - release_top(SDCARDFS_I(inode)); - WARN(1, "Top value was null!\n"); + if (!top) return -EINVAL; - } /* * Permission check on sdcardfs inode. @@ -701,10 +698,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. |