]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero
authorAlexander Hölzl <alexander.hoelzl@gmx.net>
Wed, 5 Feb 2025 17:46:51 +0000 (18:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 12:50:04 +0000 (13:50 +0100)
commit44218221b652b9f12feb5bf6404572dab07b3e03
tree69fea9ca454eb22bec98cd09d7f72a17ef515059
parentd79de85b481bfd0b85e2fd3882305b3c25dea4ab
can: j1939: j1939_sk_send_loop(): fix unable to send messages with data length zero

commit 44de577e61ed239db09f0da9d436866bef9b77dd upstream.

The J1939 standard requires the transmission of messages of length 0.

For example proprietary messages are specified with a data length of 0
to 1785. The transmission of such messages is not possible. Sending
results in no error being returned but no corresponding can frame
being generated.

Enable the transmission of zero length J1939 messages. In order to
facilitate this two changes are necessary:

1) If the transmission of a new message is requested from user space
the message is segmented in j1939_sk_send_loop(). Let the segmentation
take into account zero length messages, do not terminate immediately,
queue the corresponding skb.

2) j1939_session_skb_get_by_offset() selects the next skb to transmit
for a session. Take into account that there might be zero length skbs
in the queue.

Signed-off-by: Alexander Hölzl <alexander.hoelzl@gmx.net>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20250205174651.103238-1-alexander.hoelzl@gmx.net
Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
Cc: stable@vger.kernel.org
[mkl: commit message rephrased]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/can/j1939/socket.c
net/can/j1939/transport.c