]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - io_uring/io_uring.c
fs: Rename anon_inode_getfile_secure() and anon_inode_getfd_secure()
[thirdparty/kernel/stable.git] / io_uring / io_uring.c
index d839a80a6751c15e56ffbcd8277149001643e78c..22b98f47bb289849863a95f1adb678694ba0c5f3 100644 (file)
@@ -2674,7 +2674,11 @@ static void io_pages_free(struct page ***pages, int npages)
 
        if (!pages)
                return;
+
        page_array = *pages;
+       if (!page_array)
+               return;
+
        for (i = 0; i < npages; i++)
                unpin_user_page(page_array[i]);
        kvfree(page_array);
@@ -2758,7 +2762,9 @@ static void io_rings_free(struct io_ring_ctx *ctx)
                ctx->sq_sqes = NULL;
        } else {
                io_pages_free(&ctx->ring_pages, ctx->n_ring_pages);
+               ctx->n_ring_pages = 0;
                io_pages_free(&ctx->sqe_pages, ctx->n_sqe_pages);
+               ctx->n_sqe_pages = 0;
        }
 }
 
@@ -3829,7 +3835,8 @@ static struct file *io_uring_get_file(struct io_ring_ctx *ctx)
                return ERR_PTR(ret);
 #endif
 
-       file = anon_inode_getfile_secure("[io_uring]", &io_uring_fops, ctx,
+       /* Create a new inode so that the LSM can block the creation.  */
+       file = anon_inode_create_getfile("[io_uring]", &io_uring_fops, ctx,
                                         O_RDWR | O_CLOEXEC, NULL);
 #if defined(CONFIG_UNIX)
        if (IS_ERR(file)) {