lkml.org 
[lkml]   [2020]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.5 129/257] io_uring: remove bogus RLIMIT_NOFILE check in file registration
    Date
    From: Jens Axboe <axboe@kernel.dk>

    commit c336e992cb1cb1db9ee608dfb30342ae781057ab upstream.

    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>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/io_uring.c | 7 -------
    1 file changed, 7 deletions(-)

    --- a/fs/io_uring.c
    +++ b/fs/io_uring.c
    @@ -4162,13 +4162,6 @@ static int __io_sqe_files_scm(struct io_
    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;

    \
     
     \ /
      Last update: 2020-04-16 15:53    [W:3.306 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site