]> git.baikalelectronics.ru Git - kernel.git/commit
Return the right error value when dup[23]() newfd argument is too large
authorAl Viro <viro@ZenIV.linux.org.uk>
Wed, 31 Oct 2012 03:37:48 +0000 (03:37 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 31 Oct 2012 04:27:28 +0000 (21:27 -0700)
commit9c5e6619cfa5a675fe9e5bd4503580e3b7ff83c1
tree84d95521c8e298b0595be4f66ab5540154d6217b
parent327f2235a453034bfdda4cb248fb2087b0003da1
Return the right error value when dup[23]() newfd argument is too large

Jack Lin reports that the error return from dup3() for the RLIMIT_NOFILE
case changed incorrectly after 3.6.

The culprit is commit 5e5ae75609a7 ("take rlimit check to callers of
expand_files()") which when it moved the "return -EMFILE" out to the
caller, didn't notice that the dup3() had special code to turn the
EMFILE return into EBADF.

The replace_fd() helper that got added later then inherited the bug too.

Reported-by: Jack Lin <linliangjie@huawei.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[ Noted more bugs, wrote proper changelog, fixed up typos - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/file.c