ANDROID: sdcardfs: d_splice_alias can return error values
authorDaniel Rosenberg <drosen@google.com>
Wed, 7 Jun 2017 19:44:50 +0000 (12:44 -0700)
committerDaniel Rosenberg <drosen@google.com>
Tue, 30 Jan 2018 03:40:10 +0000 (19:40 -0800)
We must check that d_splice_alias was successful before using its
output.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 62390017
Change-Id: Ifda0a052fb3f67e35c635a4e5e907876c5400978

fs/sdcardfs/lookup.c

index 83f6083e5aad0f64be14e7f2978b696116b57588..7dab5f76896b1d30f9ce8de9a801ded38776dc60 100644 (file)
@@ -199,7 +199,8 @@ static struct dentry *__sdcardfs_interpose(struct dentry *dentry,
 
        ret_dentry = d_splice_alias(inode, dentry);
        dentry = ret_dentry ?: dentry;
-       update_derived_permission_lock(dentry);
+       if (!IS_ERR(dentry))
+               update_derived_permission_lock(dentry);
 out:
        return ret_dentry;
 }