eventpoll: ensure we pass back -EBADF for a bad file descriptor epoll-min_ts epoll-min_ts-2022-12-08
authorJens Axboe <axboe@kernel.dk>
Wed, 7 Dec 2022 16:23:06 +0000 (09:23 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 8 Dec 2022 14:05:42 +0000 (07:05 -0700)
commit73b9320234c0ad1b5e6f576abb796221eb088c64
tree82c16dccade02688fab59351c5269770357e609f
parent1265ae6b60afb035f4a1a0594a928902238c42f4
eventpoll: ensure we pass back -EBADF for a bad file descriptor

A previous commit moved file checking earlier in epoll_ctl(), and as a
result, we now have error == -EINVAL going into the test case for
whether or not the passed in target file is valid or not. This should be
-EBADF as per earlier, assign it correctly, otherwise epoll_ctl02 from
LTP correctly identifies this bad return value:

epoll_ctl02.c:87: TFAIL: epoll_clt(...) if fd is an invalid fd expected EBADF: EINVAL (22)

Fixes: 3fe64a3a96d4 ("eventpoll: move file checking earlier for epoll_ctl()")
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/eventpoll.c