Re: [PATCH RFC] can: isotp: isotp_sendmsg(): return error on FC timeout on TX path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 06.05.21 15:36, Marc Kleine-Budde wrote:
Link: https://github.com/hartkopp/can-isotp/pull/43
Cc: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>
Cc: Sottas Guillaume (LMB) <Guillaume.Sottas@xxxxxxxxxxxx>
Signed-off-by: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
---
Hey Sottas,

can you check if this fixes your problem and that normal operation
still works.

regards,
Marc

  net/can/isotp.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/net/can/isotp.c b/net/can/isotp.c
index 9f94ad3caee9..823f047a28ad 100644
--- a/net/can/isotp.c
+++ b/net/can/isotp.c
@@ -954,6 +954,9 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
  	if (wait_tx_done) {
  		/* wait for complete transmission of current pdu */
  		wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE);
+
+		if (sk->sk_err)
+			return sk->sk_err;

That's a nice simple improvement.

But it has to be a negative value:

	return -sk->sk_err;

Your patch produces this:

$ date +%S.%N && ./isotpsend vcan0 -s 123 -d 321 -D 44 -b && date +%S.%N
55.587968123
retval 70 errno 0
wrote only 70 from 44 byte
56.594017244

With the negative value you get:

$ date +%S.%N && ./isotpsend vcan0 -s 123 -d 321 -D 44 -b && date +%S.%N
22.989331212
retval -1 errno 70
write: Communication error on send

Which we would need.

Tested-by: Oliver Hartkopp <socketcan@xxxxxxxxxxxx>

Many thanks,
Oliver



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux