提交 b2a54484 编写于 作者: Y Yejune Deng 提交者: Zheng Zengkai

io_uring: simplify io_remove_personalities()

mainline inclusion
from mainline-v5.12-rc1
commit 0bead8cd
category: bugfix
bugzilla: 50492
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0bead8cd39b9c9c7c4e902018ccf129107ac50ef

---------------------------

The function io_remove_personalities() is very similar to
io_unregister_personality(),so implement io_remove_personalities()
calling io_unregister_personality().
Signed-off-by: NYejune Deng <yejune.deng@gmail.com>
Reviewed-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: Nyangerkun <yangerkun@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 3f03fbbb
......@@ -8482,9 +8482,8 @@ static int io_uring_fasync(int fd, struct file *file, int on)
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);
......@@ -8492,7 +8491,17 @@ static int io_remove_personalities(int id, void *p, void *data)
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;
}
......@@ -9583,21 +9592,6 @@ static int io_register_personality(struct io_ring_ctx *ctx)
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)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册