diff mbox series

[net] can: isotp: isotp_sendmsg(): fix return error fix on TX path

Message ID 20230622090122.574506-2-mkl@pengutronix.de (mailing list archive)
State Accepted
Commit e38910c0072b541a91954682c8b074a93e57c09b
Delegated to: Netdev Maintainers
Headers show
Series [net] can: isotp: isotp_sendmsg(): fix return error fix on TX path | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 2 maintainers not CCed: pabeni@redhat.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Marc Kleine-Budde June 22, 2023, 9:01 a.m. UTC
From: Oliver Hartkopp <socketcan@hartkopp.net>

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>
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>
---
 net/can/isotp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


base-commit: 7f4e09700bdc13ce9aafa279bc999051e9bcda35

Comments

patchwork-bot+netdevbpf@kernel.org June 23, 2023, 3:10 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (main)
by Marc Kleine-Budde <mkl@pengutronix.de>:

On Thu, 22 Jun 2023 11:01:22 +0200 you wrote:
> From: Oliver Hartkopp <socketcan@hartkopp.net>
> 
> 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.
> 
> [...]

Here is the summary with links:
  - [net] can: isotp: isotp_sendmsg(): fix return error fix on TX path
    https://git.kernel.org/netdev/net/c/e38910c0072b

You are awesome, thank you!
diff mbox series

Patch

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
@@ -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;