public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: remove bogus RLIMIT_NOFILE check in file registration
@ 2020-04-03 19:57 Jens Axboe
  0 siblings, 0 replies; only message in thread
From: Jens Axboe @ 2020-04-03 19:57 UTC (permalink / raw)
  To: io-uring

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: [email protected] # v5.1+
Signed-off-by: Jens Axboe <[email protected]>

---

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;

-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-03 19:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-03 19:57 [PATCH] io_uring: remove bogus RLIMIT_NOFILE check in file registration Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox