mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: "Alexander Hölzl" <alexander.hoelzl@gmx.net>
Cc: robin@protonic.nl, socketcan@hartkopp.net, davem@davemloft.net,
	 edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	corbet@lwn.net,  kernel@pengutronix.de,
	linux-can@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] j1939: fix unable to send messages with data length zero
Date: Tue, 7 Jan 2025 14:48:17 +0100	[thread overview]
Message-ID: <20250107-conscious-daring-lemming-c63aa8-mkl@pengutronix.de> (raw)
In-Reply-To: <20250107133217.119646-1-alexander.hoelzl@gmx.net>

[-- Attachment #1: Type: text/plain, Size: 2339 bytes --]

On 07.01.2025 14:32:17, Alexander Hölzl wrote:
> The J1939 standard requires the transmission of messages of length 0.
> For example the proprietary messages are specified with a data length
> of 0 to 1785. The transmission of such messages was not possible.
> Sending such a message resulted in no error being returned but no
> corresponding can frame being generated.

What does your patch do? Please describe it here.

Marc

> Signed-off-by: Alexander Hölzl <alexander.hoelzl@gmx.net>
> ---
>  net/can/j1939/socket.c    | 4 ++--
>  net/can/j1939/transport.c | 5 +++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
> index 305dd72c844c..17226b2341d0 100644
> --- a/net/can/j1939/socket.c
> +++ b/net/can/j1939/socket.c
> @@ -1132,7 +1132,7 @@ static int j1939_sk_send_loop(struct j1939_priv *priv,  struct sock *sk,
> 
>  	todo_size = size;
> 
> -	while (todo_size) {
> +	do {
>  		struct j1939_sk_buff_cb *skcb;
> 
>  		segment_size = min_t(size_t, J1939_MAX_TP_PACKET_SIZE,
> @@ -1177,7 +1177,7 @@ static int j1939_sk_send_loop(struct j1939_priv *priv,  struct sock *sk,
> 
>  		todo_size -= segment_size;
>  		session->total_queued_size += segment_size;
> -	}
> +	} while (todo_size);
> 
>  	switch (ret) {
>  	case 0: /* OK */
> diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
> index 319f47df3330..99832e60c08d 100644
> --- a/net/can/j1939/transport.c
> +++ b/net/can/j1939/transport.c
> @@ -382,8 +382,9 @@ sk_buff *j1939_session_skb_get_by_offset(struct j1939_session *session,
>  	skb_queue_walk(&session->skb_queue, do_skb) {
>  		do_skcb = j1939_skb_to_cb(do_skb);
> 
> -		if (offset_start >= do_skcb->offset &&
> -		    offset_start < (do_skcb->offset + do_skb->len)) {
> +		if ((offset_start >= do_skcb->offset &&
> +		     offset_start < (do_skcb->offset + do_skb->len)) ||
> +			(offset_start == 0 && do_skcb->offset == 0 && do_skb->len == 0)) {
>  			skb = do_skb;
>  		}
>  	}
> --
> 2.43.0
> 
> 
> 

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2025-01-07 13:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 13:32 Alexander Hölzl
2025-01-07 13:48 ` Marc Kleine-Budde [this message]
2025-01-07 17:17   ` Alexander Hölzl
2025-01-16  8:37     ` Oleksij Rempel
2025-02-05 17:46 Alexander Hölzl
2025-02-06  7:57 ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250107-conscious-daring-lemming-c63aa8-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=alexander.hoelzl@gmx.net \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robin@protonic.nl \
    --cc=socketcan@hartkopp.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®