* FAILED: patch "[PATCH] io_uring: use right issue_flags for splice/tee" failed to apply to 5.17-stable tree
@ 2022-04-18 9:54 gregkh
2022-04-18 12:43 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2022-04-18 9:54 UTC (permalink / raw)
To: asml.silence, axboe; +Cc: stable
The patch below does not apply to the 5.17-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e941976659f1f6834077a1596bf53e6bdb10e90b Mon Sep 17 00:00:00 2001
From: Pavel Begunkov <asml.silence@gmail.com>
Date: Wed, 13 Apr 2022 16:10:33 +0100
Subject: [PATCH] io_uring: use right issue_flags for splice/tee
Pass right issue_flags into into io_file_get_fixed() instead of
IO_URING_F_UNLOCKED. It's probably not a problem at the moment but let's
do it safer.
Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/7d242daa9df5d776907686977cd29fbceb4a2d8d.1649862516.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 6b1a98697dcf..3d6cbf77c89d 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4358,7 +4358,7 @@ static int io_tee(struct io_kiocb *req, unsigned int issue_flags)
return -EAGAIN;
if (sp->flags & SPLICE_F_FD_IN_FIXED)
- in = io_file_get_fixed(req, sp->splice_fd_in, IO_URING_F_UNLOCKED);
+ in = io_file_get_fixed(req, sp->splice_fd_in, issue_flags);
else
in = io_file_get_normal(req, sp->splice_fd_in);
if (!in) {
@@ -4400,7 +4400,7 @@ static int io_splice(struct io_kiocb *req, unsigned int issue_flags)
return -EAGAIN;
if (sp->flags & SPLICE_F_FD_IN_FIXED)
- in = io_file_get_fixed(req, sp->splice_fd_in, IO_URING_F_UNLOCKED);
+ in = io_file_get_fixed(req, sp->splice_fd_in, issue_flags);
else
in = io_file_get_normal(req, sp->splice_fd_in);
if (!in) {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: use right issue_flags for splice/tee" failed to apply to 5.17-stable tree
2022-04-18 9:54 FAILED: patch "[PATCH] io_uring: use right issue_flags for splice/tee" failed to apply to 5.17-stable tree gregkh
@ 2022-04-18 12:43 ` Jens Axboe
2022-04-18 13:06 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2022-04-18 12:43 UTC (permalink / raw)
To: gregkh, asml.silence; +Cc: stable
[-- Attachment #1: Type: text/plain, Size: 386 bytes --]
On 4/18/22 3:54 AM, gregkh@linuxfoundation.org wrote:
>
> The patch below does not apply to the 5.17-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
Here's this one, and the two others that failed to apply for
5.17-stable.
--
Jens Axboe
[-- Attachment #2: 0003-io_uring-fix-poll-error-reporting.patch --]
[-- Type: text/x-patch, Size: 1400 bytes --]
From 8f8cabb77826b786c2f5a1854abad465f9fbfef2 Mon Sep 17 00:00:00 2001
From: Pavel Begunkov <asml.silence@gmail.com>
Date: Mon, 18 Apr 2022 06:41:20 -0600
Subject: [PATCH 3/3] io_uring: fix poll error reporting
commit 7179c3ce3dbff646c55f7cd664a895f462f049e5 upstream.
We should not return an error code in req->result in
io_poll_check_events(), because it may get mangled and returned as
success. Just return the error code directly, the callers will fail the
request or proceed accordingly.
Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/5f03514ee33324dc811fb93df84aee0f695fb044.1649862516.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
fs/io_uring.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 293b04c7edda..7b4d48cfe44c 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5509,9 +5509,8 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked)
unsigned flags = locked ? 0 : IO_URING_F_UNLOCKED;
if (unlikely(!io_assign_file(req, flags)))
- req->result = -EBADF;
- else
- req->result = vfs_poll(req->file, &pt) & poll->events;
+ return -EBADF;
+ req->result = vfs_poll(req->file, &pt) & poll->events;
}
/* multishot, just fill an CQE and proceed */
--
2.35.1
[-- Attachment #3: 0002-io_uring-fix-poll-file-assign-deadlock.patch --]
[-- Type: text/x-patch, Size: 1291 bytes --]
From cbb3f5938cdf975f2970f9b5674a56e6fa1a59ff Mon Sep 17 00:00:00 2001
From: Pavel Begunkov <asml.silence@gmail.com>
Date: Mon, 18 Apr 2022 06:40:30 -0600
Subject: [PATCH 2/3] io_uring: fix poll file assign deadlock
commit cce64ef01308b677a687d90927fc2b2e0e1cba67 upstream.
We pass "unlocked" into io_assign_file() in io_poll_check_events(),
which can lead to double locking.
Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/2476d4ae46554324b599ee4055447b105f20a75a.1649862516.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
fs/io_uring.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 26832d166ca2..293b04c7edda 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5506,8 +5506,9 @@ static int io_poll_check_events(struct io_kiocb *req, bool locked)
if (!req->result) {
struct poll_table_struct pt = { ._key = poll->events };
+ unsigned flags = locked ? 0 : IO_URING_F_UNLOCKED;
- if (unlikely(!io_assign_file(req, IO_URING_F_UNLOCKED)))
+ if (unlikely(!io_assign_file(req, flags)))
req->result = -EBADF;
else
req->result = vfs_poll(req->file, &pt) & poll->events;
--
2.35.1
[-- Attachment #4: 0001-io_uring-use-right-issue_flags-for-splice-tee.patch --]
[-- Type: text/x-patch, Size: 1624 bytes --]
From d5f62d8199e00d5af1a57f83ca1fcd49fecd3a36 Mon Sep 17 00:00:00 2001
From: Pavel Begunkov <asml.silence@gmail.com>
Date: Wed, 13 Apr 2022 16:10:33 +0100
Subject: [PATCH 1/3] io_uring: use right issue_flags for splice/tee
commit e941976659f1f6834077a1596bf53e6bdb10e90b upstream.
Pass right issue_flags into into io_file_get_fixed() instead of
IO_URING_F_UNLOCKED. It's probably not a problem at the moment but let's
do it safer.
Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/7d242daa9df5d776907686977cd29fbceb4a2d8d.1649862516.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
fs/io_uring.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 1a9630dc5361..26832d166ca2 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4136,7 +4136,7 @@ static int io_tee(struct io_kiocb *req, unsigned int issue_flags)
return -EAGAIN;
if (sp->flags & SPLICE_F_FD_IN_FIXED)
- in = io_file_get_fixed(req, sp->splice_fd_in, IO_URING_F_UNLOCKED);
+ in = io_file_get_fixed(req, sp->splice_fd_in, issue_flags);
else
in = io_file_get_normal(req, sp->splice_fd_in);
if (!in) {
@@ -4178,7 +4178,7 @@ static int io_splice(struct io_kiocb *req, unsigned int issue_flags)
return -EAGAIN;
if (sp->flags & SPLICE_F_FD_IN_FIXED)
- in = io_file_get_fixed(req, sp->splice_fd_in, IO_URING_F_UNLOCKED);
+ in = io_file_get_fixed(req, sp->splice_fd_in, issue_flags);
else
in = io_file_get_normal(req, sp->splice_fd_in);
if (!in) {
--
2.35.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: use right issue_flags for splice/tee" failed to apply to 5.17-stable tree
2022-04-18 12:43 ` Jens Axboe
@ 2022-04-18 13:06 ` Greg KH
2022-04-18 13:45 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2022-04-18 13:06 UTC (permalink / raw)
To: Jens Axboe; +Cc: asml.silence, stable
On Mon, Apr 18, 2022 at 06:43:13AM -0600, Jens Axboe wrote:
> On 4/18/22 3:54 AM, gregkh@linuxfoundation.org wrote:
> >
> > The patch below does not apply to the 5.17-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
>
> Here's this one, and the two others that failed to apply for
> 5.17-stable.
Thanks for these, now queued up.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FAILED: patch "[PATCH] io_uring: use right issue_flags for splice/tee" failed to apply to 5.17-stable tree
2022-04-18 13:06 ` Greg KH
@ 2022-04-18 13:45 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2022-04-18 13:45 UTC (permalink / raw)
To: Greg KH; +Cc: asml.silence, stable
On 4/18/22 7:06 AM, Greg KH wrote:
> On Mon, Apr 18, 2022 at 06:43:13AM -0600, Jens Axboe wrote:
>> On 4/18/22 3:54 AM, gregkh@linuxfoundation.org wrote:
>>>
>>> The patch below does not apply to the 5.17-stable tree.
>>> If someone wants it applied there, or to any other stable or longterm
>>> tree, then please email the backport, including the original git commit
>>> id to <stable@vger.kernel.org>.
>>
>> Here's this one, and the two others that failed to apply for
>> 5.17-stable.
>
> Thanks for these, now queued up.
Thanks Greg.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-18 14:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-18 9:54 FAILED: patch "[PATCH] io_uring: use right issue_flags for splice/tee" failed to apply to 5.17-stable tree gregkh
2022-04-18 12:43 ` Jens Axboe
2022-04-18 13:06 ` Greg KH
2022-04-18 13:45 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox