Skip to content

Commit e38910c

Browse files
hartkoppmarckleinebudde
authored andcommitted
can: isotp: isotp_sendmsg(): fix return error fix on TX path
With commit d674a8f ("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: d674a8f ("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> Link: https://lore.kernel.org/all/20230607072708.38809-1-socketcan@hartkopp.net Cc: stable@vger.kernel.org Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 7f4e097 commit e38910c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

net/can/isotp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,9 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
11121112
if (err)
11131113
goto err_event_drop;
11141114

1115-
if (sk->sk_err)
1116-
return -sk->sk_err;
1115+
err = sock_error(sk);
1116+
if (err)
1117+
return err;
11171118
}
11181119

11191120
return size;

0 commit comments

Comments
 (0)