Skip to content

Commit dc7e76b

Browse files
axboeAl Viro
authored andcommitted
io_uring: IORING_OP_F[GS]ETXATTR is fine with REQ_F_FIXED_FILE
Rejection of IOSQE_FIXED_FILE combined with IORING_OP_[GS]ETXATTR is fine - these do not take a file descriptor, so such combination makes no sense. The checks are misplaced, though - as it is, they triggers on IORING_OP_F[GS]ETXATTR as well, and those do take a file reference, no matter the origin. Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent e896474 commit dc7e76b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

io_uring/xattr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ static int __io_getxattr_prep(struct io_kiocb *req,
4848
const char __user *name;
4949
int ret;
5050

51-
if (unlikely(req->flags & REQ_F_FIXED_FILE))
52-
return -EBADF;
53-
5451
ix->filename = NULL;
5552
ix->ctx.kvalue = NULL;
5653
name = u64_to_user_ptr(READ_ONCE(sqe->addr));
@@ -90,6 +87,9 @@ int io_getxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
9087
const char __user *path;
9188
int ret;
9289

90+
if (unlikely(req->flags & REQ_F_FIXED_FILE))
91+
return -EBADF;
92+
9393
ret = __io_getxattr_prep(req, sqe);
9494
if (ret)
9595
return ret;
@@ -152,9 +152,6 @@ static int __io_setxattr_prep(struct io_kiocb *req,
152152
const char __user *name;
153153
int ret;
154154

155-
if (unlikely(req->flags & REQ_F_FIXED_FILE))
156-
return -EBADF;
157-
158155
ix->filename = NULL;
159156
name = u64_to_user_ptr(READ_ONCE(sqe->addr));
160157
ix->ctx.cvalue = u64_to_user_ptr(READ_ONCE(sqe->addr2));
@@ -183,6 +180,9 @@ int io_setxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
183180
const char __user *path;
184181
int ret;
185182

183+
if (unlikely(req->flags & REQ_F_FIXED_FILE))
184+
return -EBADF;
185+
186186
ret = __io_setxattr_prep(req, sqe);
187187
if (ret)
188188
return ret;

0 commit comments

Comments
 (0)