Skip to contentSkip to conversation

pull-request: can 2021-10-19

PATCH New Marc Kleine-Budde 1 participant 2 messages Oct 19, 2021

Subsystems (5)
lore
Share & tools
lore

Marc Kleine-Budde

author maintainer
#0 lore raw

Hello Jakub, hello David,

this is a pull request of a single patch for net/master.

The patch is by me and fixes the error handling in case of a FC timeout in the TX path of the ISOTOP CAN protocol.

regards,
Marc

---

The following changes since commit 8a64ef042eab8a6cec04a6c79d44d1af79b628ca:

nfp: bpf: silence bitwise vs. logical OR warning (2021-10-18 14:50:01 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-5.15-20211019

for you to fetch changes up to d674a8f123b4096d85955c7eaabec688f29724c9:

can: isotp: isotp_sendmsg(): fix return error on FC timeout on TX path (2021-10-19 09:10:30 +0200)

----------------------------------------------------------------
linux-can-fixes-for-5.15-20211019

----------------------------------------------------------------
Marc Kleine-Budde (1):
can: isotp: isotp_sendmsg(): fix return error on FC timeout on TX path

 net/can/isotp.c | 3 +++
 1 file changed, 3 insertions(+)
author maintainer
#1 lore raw

PATCH 1/1 can: isotp: isotp_sendmsg(): fix return error on FC timeout on TX path

When the a large chunk of data send and the receiver does not send a Flow Control frame back in time, the sendmsg() does not return a error code, but the number of bytes sent corresponding to the size of the packet.

If a timeout occurs the isotp_tx_timer_handler() is fired, sets sk->sk_err and calls the sk->sk_error_report() function. It was wrongly expected that the error would be propagated to user space in every case. For isotp_sendmsg() blocking on wait_event_interruptible() this is not the case.

This patch fixes the problem by checking if sk->sk_err is set and returning the error to user space.

---
 net/can/isotp.c | 3 +++
 1 file changed, 3 insertions(+)
net/can/isotp.c +3 -0
index d1f54273c0bb..df6968b28bf4 100644
@@ -971,6 +971,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;
 	}
 
 	return size;

base-commit: 8a64ef042eab8a6cec04a6c79d44d1af79b628ca

Signature · 1 line
2.33.0