io_uring: simplify io_remove_personalities()
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@gmail.com> Reviewed-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Родитель
4014d943cb
Коммит
0bead8cd39
|
@ -8805,9 +8805,8 @@ static int io_uring_fasync(int fd, struct file *file, int on)
|
||||||
return fasync_helper(fd, file, on, &ctx->cq_fasync);
|
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;
|
struct io_identity *iod;
|
||||||
|
|
||||||
iod = idr_remove(&ctx->personality_idr, id);
|
iod = idr_remove(&ctx->personality_idr, id);
|
||||||
|
@ -8815,7 +8814,17 @@ static int io_remove_personalities(int id, void *p, void *data)
|
||||||
put_cred(iod->creds);
|
put_cred(iod->creds);
|
||||||
if (refcount_dec_and_test(&iod->count))
|
if (refcount_dec_and_test(&iod->count))
|
||||||
kfree(iod);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9951,21 +9960,6 @@ static int io_register_personality(struct io_ring_ctx *ctx)
|
||||||
return ret;
|
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,
|
static int io_register_restrictions(struct io_ring_ctx *ctx, void __user *arg,
|
||||||
unsigned int nr_args)
|
unsigned int nr_args)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче