From: Daniel Rosenberg Date: Mon, 22 May 2017 20:23:56 +0000 (-0700) Subject: ANDROID: sdcardfs: Check for NULL in revalidate X-Git-Tag: release-20171130_firefly~4^2~100^2~100 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a9d65e521a0fed3668957719432d5c42383a3647;p=firefly-linux-kernel-4.4.55.git ANDROID: sdcardfs: Check for NULL in revalidate If the inode is in the process of being evicted, the top value may be NULL. Signed-off-by: Daniel Rosenberg Bug: 38502532 Change-Id: I0b9d04aab621e0398d44d1c5dc53293106aa5f89 --- diff --git a/fs/sdcardfs/dentry.c b/fs/sdcardfs/dentry.c index 83ae9103a0f6..13da7e5245bd 100644 --- a/fs/sdcardfs/dentry.c +++ b/fs/sdcardfs/dentry.c @@ -109,14 +109,16 @@ static int sdcardfs_d_revalidate(struct dentry *dentry, unsigned int flags) goto out; /* If our top's inode is gone, we may be out of date */ - inode = d_inode(dentry); + inode = igrab(d_inode(dentry)); if (inode) { data = top_data_get(SDCARDFS_I(inode)); - if (data->abandoned) { + if (!data || data->abandoned) { d_drop(dentry); err = 0; } - data_put(data); + if (data) + data_put(data); + iput(inode); } out: