From: Al Viro Date: Wed, 5 Aug 2015 03:23:50 +0000 (-0400) Subject: may_follow_link() should use nd->inode X-Git-Tag: v4.9.8~3779^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa65fa35ba6b589a12a6025739c2d935dd743b5a;p=platform%2Fkernel%2Flinux-rpi3.git may_follow_link() should use nd->inode Now that we can get there in RCU mode, we shouldn't play with nd->path.dentry->d_inode - it's not guaranteed to be stable. Use nd->inode instead. Reported-by: Hugh Dickins Signed-off-by: Al Viro --- diff --git a/fs/namei.c b/fs/namei.c index fbbcf09..1c2105e 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -879,7 +879,7 @@ static inline int may_follow_link(struct nameidata *nd) return 0; /* Allowed if parent directory not sticky and world-writable. */ - parent = nd->path.dentry->d_inode; + parent = nd->inode; if ((parent->i_mode & (S_ISVTX|S_IWOTH)) != (S_ISVTX|S_IWOTH)) return 0;