]> git.baikalelectronics.ru Git - kernel.git/commit
make build_open_flags() treat O_CREAT | O_EXCL as implying O_NOFOLLOW
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 9 Jan 2020 01:19:38 +0000 (20:19 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 27 Feb 2020 19:43:56 +0000 (14:43 -0500)
commit15bb9417c555a9b87945714e6df950a2d1444b75
tree01cefcb0dbfb2a3a5dfd95cb8871aa802fadfbd7
parentf866e3e00af27941c70ab896c12e1d697eb160fb
make build_open_flags() treat O_CREAT | O_EXCL as implying O_NOFOLLOW

O_CREAT | O_EXCL means "-EEXIST if we run into a trailing symlink".
As it is, we might or might not have LOOKUP_FOLLOW in op->intent
in that case - that depends upon having O_NOFOLLOW in open flags.
It doesn't matter, since we won't be checking it in that case -
do_last() bails out earlier.

However, making sure it's not set (i.e. acting as if we had an explicit
O_NOFOLLOW) makes the behaviour more explicit and allows to reorder the
check for O_CREAT | O_EXCL in do_last() with the call of step_into()
immediately following it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c
fs/open.c