public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Antonio Pastor <antonio.pastor@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: netdev@vger.kernel.org, pabeni@redhat.com, horms@kernel.org,
	kuba@kernel.org, "David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: 802: reset skb->transport_header
Date: Thu, 2 Jan 2025 19:18:58 -0500	[thread overview]
Message-ID: <62d899b3-dad0-4e61-b4da-4ce969dc7cf2@gmail.com> (raw)
In-Reply-To: <CANn89iKkrZySKRidPLFa=KsM6h6OeO2rgW6t5WNY9OWfJazu8g@mail.gmail.com>

> Sorry, this patch is wrong, it does not fix the potential issue yet.


No worries! Thanks for your patience with this. Much appreciated.


> Note how skb_transport_header(skb) is used in
> find_snap_client(skb_transport_header(skb));


I've spent so much time trying to figure out why the offset is wrong I 
lost sight that the core issue is that it is being used to begin with. 
Paolo Abeni hinted at that too.


> The proper way to fix the issue is to not rely on the transport header
> at all, only reset it after pulling the network header.
>
>
> diff --git a/net/802/psnap.c b/net/802/psnap.c
> index fca9d454905fe37d6b838f0f00b3a16767e44e74..389df460c8c4b92f9ec6198247db0ba15bfb8f2e
> 100644
> --- a/net/802/psnap.c
> +++ b/net/802/psnap.c
> @@ -55,11 +55,11 @@ static int snap_rcv(struct sk_buff *skb, struct
> net_device *dev,
>                  goto drop;
>
>          rcu_read_lock();
> -       proto = find_snap_client(skb_transport_header(skb));
> +       proto = find_snap_client(skb->data);
>          if (proto) {
>                  /* Pass the frame on. */
> -               skb->transport_header += 5;
>                  skb_pull_rcsum(skb, 5);
> +               skb_reset_transport_header(skb);
>                  rc = proto->rcvfunc(skb, dev, &snap_packet_type, orig_dev);
>          }
>          rcu_read_unlock();


Will send V2.



  reply	other threads:[~2025-01-03  0:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241220142020.1131017-1-antonio.pastor@gmail.com>
2024-12-23 13:39 ` [PATCH net v2] net: llc: explicitly set skb->transport_header Antonio Pastor
2024-12-23 13:54   ` Eric Dumazet
     [not found]     ` <c8145fd0-df13-4c6a-8678-fbf9547cc112@gmail.com>
2024-12-23 18:18       ` Eric Dumazet
2024-12-25  1:35         ` Antonio Pastor
2024-12-28  2:12           ` [PATCH net] net: 802: reset skb->transport_header Antonio Pastor
2024-12-30  8:26             ` Eric Dumazet
2025-01-03  0:18               ` Antonio Pastor [this message]
2025-01-03  1:23               ` [PATCH net v2] net: 802: LLC+SNAP OID:PID lookup on start of skb data Antonio Pastor
2025-01-03  8:46                 ` Eric Dumazet
2025-01-04 16:20                 ` patchwork-bot+netdevbpf
2024-12-25  1:07     ` [PATCH net v3] net: llc: reset skb->transport_header Antonio Pastor
2024-12-26  9:38       ` Eric Dumazet
2024-12-27 19:30       ` patchwork-bot+netdevbpf

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=62d899b3-dad0-4e61-b4da-4ce969dc7cf2@gmail.com \
    --to=antonio.pastor@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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