This is a note to let you know that I've just added the patch titled io_uring: simplify io_remove_personalities() to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: io_uring-simplify-io_remove_personalities.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Thu Jul 15 01:10:15 PM CEST 2021 From: Hanjun Guo <guohanjun@xxxxxxxxxx> Date: Tue, 13 Jul 2021 17:18:33 +0800 Subject: io_uring: simplify io_remove_personalities() To: <stable@xxxxxxxxxxxxxxx> Cc: <linux-kernel@xxxxxxxxxxxxxxx>, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>, Sasha Levin <sashal@xxxxxxxxxx>, Yejune Deng <yejune.deng@xxxxxxxxx>, Jens Axboe <axboe@xxxxxxxxx>, Hanjun Guo <guohanjun@xxxxxxxxxx> Message-ID: <1626167917-11972-4-git-send-email-guohanjun@xxxxxxxxxx> From: Yejune Deng <yejune.deng@xxxxxxxxx> commit 0bead8cd39b9c9c7c4e902018ccf129107ac50ef upstream. The function io_remove_personalities() is very similar to io_unregister_personality(),so implement io_remove_personalities() calling io_unregister_personality(). Signed-off-by: Yejune Deng <yejune.deng@xxxxxxxxx> Reviewed-by: Pavel Begunkov <asml.silence@xxxxxxxxx> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> Signed-off-by: Hanjun Guo <guohanjun@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/io_uring.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8505,9 +8505,8 @@ static int io_uring_fasync(int fd, struc return fasync_helper(fd, file, on, &ctx->cq_fasync); } -static int io_remove_personalities(int id, void *p, void *data) +static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id) { - struct io_ring_ctx *ctx = data; struct io_identity *iod; iod = idr_remove(&ctx->personality_idr, id); @@ -8515,7 +8514,17 @@ static int io_remove_personalities(int i put_cred(iod->creds); if (refcount_dec_and_test(&iod->count)) kfree(iod); + return 0; } + + return -EINVAL; +} + +static int io_remove_personalities(int id, void *p, void *data) +{ + struct io_ring_ctx *ctx = data; + + io_unregister_personality(ctx, id); return 0; } @@ -9606,21 +9615,6 @@ static int io_register_personality(struc return ret; } -static int io_unregister_personality(struct io_ring_ctx *ctx, unsigned id) -{ - struct io_identity *iod; - - iod = idr_remove(&ctx->personality_idr, id); - if (iod) { - put_cred(iod->creds); - if (refcount_dec_and_test(&iod->count)) - kfree(iod); - return 0; - } - - return -EINVAL; -} - static int io_register_restrictions(struct io_ring_ctx *ctx, void __user *arg, unsigned int nr_args) { Patches currently in stable-queue which might be from guohanjun@xxxxxxxxxx are queue-5.10/io_uring-simplify-io_remove_personalities.patch queue-5.10/io_uring-convert-personality_idr-to-xarray.patch queue-5.10/loop-fix-i-o-error-on-fsync-in-detached-loop-devices.patch queue-5.10/io_uring-convert-io_buffer_idr-to-xarray.patch queue-5.10/mm-hwpoison-return-ebusy-when-migration-fails.patch queue-5.10/scsi-iscsi-fix-iscsi-cls-conn-state.patch queue-5.10/scsi-iscsi-fix-race-condition-between-login-and-sync-thread.patch