Skip to content

Commit

Permalink
should_follow_link(): validate ->d_seq after having decided to follow
Browse files Browse the repository at this point in the history
... otherwise d_is_symlink() above might have nothing to do with
the inode value we've got.

Cc: [email protected] # v4.2+
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Feb 28, 2016
1 parent d456564 commit a7f7754
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,11 @@ static inline int should_follow_link(struct nameidata *nd, struct path *link,
return 0;
if (!follow)
return 0;
/* make sure that d_is_symlink above matches inode */
if (nd->flags & LOOKUP_RCU) {
if (read_seqcount_retry(&link->dentry->d_seq, seq))
return -ECHILD;
}
return pick_link(nd, link, inode, seq);
}

Expand Down

0 comments on commit a7f7754

Please sign in to comment.