From: Daniel Rosenberg Date: Mon, 22 May 2017 20:23:56 +0000 (-0700) Subject: ANDROID: sdcardfs: Check for NULL in revalidate X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e332f59915ff620bb2ce50da95fcf8208bdf2e43;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.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 039c9530f86..c8f3bcbfb18 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 = dentry->d_inode; + inode = igrab(dentry->d_inode); 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: