Skip to content

Commit

Permalink
can: isotp: isotp_sendmsg(): fix return error fix on TX path
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Oliver Hartkopp <[email protected]>
Link: https://lore.kernel.org/all/[email protected]
Cc: [email protected]
Signed-off-by: Marc Kleine-Budde <[email protected]>
  • Loading branch information
hartkopp authored and marckleinebudde committed Jun 22, 2023
1 parent 7f4e097 commit e38910c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/can/isotp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,8 +1112,9 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
if (err)
goto err_event_drop;

if (sk->sk_err)
return -sk->sk_err;
err = sock_error(sk);
if (err)
return err;
}

return size;
Expand Down

0 comments on commit e38910c

Please sign in to comment.