Skip to content

Commit a026fa5

Browse files
committed
Merge tag 'io_uring-5.16-2021-12-23' of git://git.kernel.dk/linux-block
Pull io_uring fix from Jens Axboe: "Single fix for not clearing kiocb->ki_pos back to 0 for a stream, destined for stable as well" * tag 'io_uring-5.16-2021-12-23' of git://git.kernel.dk/linux-block: io_uring: zero iocb->ki_pos for stream file types
2 parents 7fe2bc1 + 7b9762a commit a026fa5

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

fs/io_uring.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,9 +2891,13 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe)
28912891
req->flags |= io_file_get_flags(file) << REQ_F_SUPPORT_NOWAIT_BIT;
28922892

28932893
kiocb->ki_pos = READ_ONCE(sqe->off);
2894-
if (kiocb->ki_pos == -1 && !(file->f_mode & FMODE_STREAM)) {
2895-
req->flags |= REQ_F_CUR_POS;
2896-
kiocb->ki_pos = file->f_pos;
2894+
if (kiocb->ki_pos == -1) {
2895+
if (!(file->f_mode & FMODE_STREAM)) {
2896+
req->flags |= REQ_F_CUR_POS;
2897+
kiocb->ki_pos = file->f_pos;
2898+
} else {
2899+
kiocb->ki_pos = 0;
2900+
}
28972901
}
28982902
kiocb->ki_flags = iocb_flags(file);
28992903
ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags));

0 commit comments

Comments
 (0)