* [PATCH] rpmsg: virtio: fix error handling in TX buffer wait
@ 2026-10-13 16:00 Atul Akella
2026-10-14 15:49 ` Mathieu Poirier
0 siblings, 1 reply; 2+ messages in thread
From: Atul Akella @ 2026-10-13 16:00 UTC (permalink / raw)
To: andersson, mathieu.poirier; +Cc: linux-remoteproc, Atul Akella
The TX buffer wait loop in rpmsg_send_offchannel_raw() ignores the
possibility of wait_event_interruptible_timeout() returning a
negative value, which happens when the wait is interrupted by a
signal. In that case the loop spins back around and re-arms the
wait instead of propagating the signal, which can stall a task
that is trying to be killed.
Separately, on a genuine timeout (return value 0) the function
returns -ERESTARTSYS, which is reserved for signal-interrupted
syscalls that the kernel may restart. A timeout is not a signal
and should not be treated as restartable; return -ETIMEDOUT
instead.
Handle both cases explicitly: return err directly when negative,
and return -ETIMEDOUT on timeout.
Fixes: bcabbccabffe ("rpmsg: add virtio-based remote processor messaging bus")
Signed-off-by: Atul Akella <atul.akella@gmail.com>
---
drivers/rpmsg/virtio_rpmsg_bus.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 1b8bb05924af..a32772d6ccbc 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -536,10 +536,13 @@ static int rpmsg_send_offchannel_raw(struct rpmsg_device *rpdev,
(msg = get_a_tx_buf(vrp)),
msecs_to_jiffies(15000));
+ if (err < 0)
+ return err;
+
/* timeout ? */
if (!err) {
dev_err(dev, "timeout waiting for a tx buffer\n");
- return -ERESTARTSYS;
+ return -ETIMEDOUT;
}
}
--
2.51.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] rpmsg: virtio: fix error handling in TX buffer wait
2026-10-13 16:00 [PATCH] rpmsg: virtio: fix error handling in TX buffer wait Atul Akella
@ 2026-10-14 15:49 ` Mathieu Poirier
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Poirier @ 2026-10-14 15:49 UTC (permalink / raw)
To: Atul Akella; +Cc: andersson, linux-remoteproc
On Tue, Oct 13, 2026 at 09:30:55PM +0530, Atul Akella wrote:
> The TX buffer wait loop in rpmsg_send_offchannel_raw() ignores the
> possibility of wait_event_interruptible_timeout() returning a
> negative value, which happens when the wait is interrupted by a
> signal. In that case the loop spins back around and re-arms the
> wait instead of propagating the signal, which can stall a task
> that is trying to be killed.
>
> Separately, on a genuine timeout (return value 0) the function
> returns -ERESTARTSYS, which is reserved for signal-interrupted
> syscalls that the kernel may restart. A timeout is not a signal
> and should not be treated as restartable; return -ETIMEDOUT
> instead.
>
> Handle both cases explicitly: return err directly when negative,
> and return -ETIMEDOUT on timeout.
>
> Fixes: bcabbccabffe ("rpmsg: add virtio-based remote processor messaging bus")
> Signed-off-by: Atul Akella <atul.akella@gmail.com>
> ---
> drivers/rpmsg/virtio_rpmsg_bus.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
> index 1b8bb05924af..a32772d6ccbc 100644
> --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> @@ -536,10 +536,13 @@ static int rpmsg_send_offchannel_raw(struct rpmsg_device *rpdev,
> (msg = get_a_tx_buf(vrp)),
> msecs_to_jiffies(15000));
>
> + if (err < 0)
> + return err;
> +
> /* timeout ? */
> if (!err) {
> dev_err(dev, "timeout waiting for a tx buffer\n");
> - return -ERESTARTSYS;
> + return -ETIMEDOUT;
Applied.
Thanks,
Mathieu
> }
> }
>
> --
> 2.51.0.windows.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-14 15:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 16:00 [PATCH] rpmsg: virtio: fix error handling in TX buffer wait Atul Akella
2026-10-14 15:49 ` Mathieu Poirier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.