summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-04-03 22:54:26 +0300
committerJens Axboe <axboe@kernel.dk>2020-04-03 22:56:44 +0300
commitc336e992cb1cb1db9ee608dfb30342ae781057ab (patch)
tree319d1122679a2a6167f644c03f73c6f408b9a097
parentaa96bf8a9ee33457b7e3ea43e97dfa1e3a15ab20 (diff)
downloadlinux-c336e992cb1cb1db9ee608dfb30342ae781057ab.tar.xz
io_uring: remove bogus RLIMIT_NOFILE check in file registration
We already checked this limit when the file was opened, and we keep it open in the file table. Hence when we added unit_inflight to the count we want to register, we're doubly accounting these files. This results in -EMFILE for file registration, if we're at half the limit. Cc: stable@vger.kernel.org # v5.1+ Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 2460c3333f70..ce76157c2f95 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6216,13 +6216,6 @@ static int __io_sqe_files_scm(struct io_ring_ctx *ctx, int nr, int offset)
struct sk_buff *skb;
int i, nr_files;
- if (!capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN)) {
- unsigned long inflight = ctx->user->unix_inflight + nr;
-
- if (inflight > task_rlimit(current, RLIMIT_NOFILE))
- return -EMFILE;
- }
-
fpl = kzalloc(sizeof(*fpl), GFP_KERNEL);
if (!fpl)
return -ENOMEM;