* [PATCH] can: isotp: isotp_sendmsg(): fix return error fix on TX path
@ 2023-06-07 7:27 Oliver Hartkopp
0 siblings, 0 replies; only message in thread
From: Oliver Hartkopp @ 2023-06-07 7:27 UTC (permalink / raw)
To: linux-can; +Cc: Oliver Hartkopp, Carsten Schmidt
With commit d674a8f123b4 ("can: isotp: isotp_sendmsg(): fix return error
on FC timeout on TX path") the missing correct return value in the case
of a protocol error was introduced.
But the way the error value has been read and sent to the user space does
not follow the common scheme to clear the error after reading which is
provided by the sock_error() function. This leads to an error report at
the following write() attempt although everything should be working.
Fixes: d674a8f123b4 ("can: isotp: isotp_sendmsg(): fix return error on FC timeout on TX path")
Reported-by: Carsten Schmidt <carsten.schmidt-achim@t-online.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
---
net/can/isotp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/can/isotp.c b/net/can/isotp.c
index 84f9aba02901..ca9d728d6d72 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -1110,12 +1110,13 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
/* wait for complete transmission of current pdu */
err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE);
if (err)
goto err_event_drop;
- if (sk->sk_err)
- return -sk->sk_err;
+ err = sock_error(sk);
+ if (err)
+ return err;
}
return size;
err_event_drop:
--
2.30.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-07 7:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-07 7:27 [PATCH] can: isotp: isotp_sendmsg(): fix return error fix on TX path Oliver Hartkopp
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.