Netdev List
 help / color / mirror / Atom feed
From: ALOK TIWARI <alok.a.tiwari@oracle.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Aditya Gupta <adityag@linux.ibm.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [External] : Re: [REPORT] Null pointer deref in net/core/dev.c on PowerPC
Date: Wed, 17 Dec 2025 21:08:24 +0530	[thread overview]
Message-ID: <5da37621-279f-46ea-94e7-b766a6e601f3@oracle.com> (raw)
In-Reply-To: <CANn89iKjJ-P0YR-oGzEd+EvrFAQA=0LsjsYHUDpFNRHCDwXeWA@mail.gmail.com>



On 12/17/2025 8:52 PM, Eric Dumazet wrote:
>>> I will send the following fix, thanks.
>>>
>>> diff --git a/net/core/dev.c b/net/core/dev.c
>>> index 9094c0fb8c68..36dc5199037e 100644
>>> --- a/net/core/dev.c
>>> +++ b/net/core/dev.c
>>> @@ -4241,9 +4241,11 @@ static inline int __dev_xmit_skb(struct sk_buff
>>> *skb, struct Qdisc *q,
>>>                   int count = 0;
>>>
>>>                   llist_for_each_entry_safe(skb, next, ll_list, ll_node) {
>>> -                       prefetch(next);
>>> -                       prefetch(&next->priority);
>>> -                       skb_mark_not_on_list(skb);
>>> +                       if (next) {
>>> +                               prefetch(next);
>>> +                               prefetch(&next->priority);
>>> +                               skb_mark_not_on_list(skb);
>>> +                       }
>>>                           rc = dev_qdisc_enqueue(skb, q, &to_free, txq);
>>>                           count++;
>>>                   }
>>>
>> why not only ?
>> if (likely(next)) {
>>       prefetch(next);
>>       prefetch(&next->priority);
>> }
> Because we also can avoid clearing skb->next, we know it is already NULL.
> 
> Since we pay the price of a conditional, let's amortize its cost :/

Thanks a lot for the explanation, I understand the goal of amortizing 
the cost and avoiding unnecessary writes to skb->next.
Would it make sense to add if (likely(next)) around the prefetch?

Thanks,
Alok

  reply	other threads:[~2025-12-17 15:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-17 12:10 [REPORT] Null pointer deref in net/core/dev.c on PowerPC Aditya Gupta
2025-12-17 13:49 ` Eric Dumazet
2025-12-17 13:58   ` Eric Dumazet
2025-12-17 14:41     ` Eric Dumazet
2025-12-17 15:01       ` [External] : " ALOK TIWARI
2025-12-17 15:22         ` Eric Dumazet
2025-12-17 15:38           ` ALOK TIWARI [this message]
2025-12-17 15:44             ` Eric Dumazet
2025-12-17 18:03       ` Aditya Gupta

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=5da37621-279f-46ea-94e7-b766a6e601f3@oracle.com \
    --to=alok.a.tiwari@oracle.com \
    --cc=adityag@linux.ibm.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --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