Skip to content

Commit c77a500

Browse files
edumazetopsiff
authored andcommitted
net: avoid prefetching NULL pointers
mainline inclusion from mainline-v6.19-rc4 category: bugfix Aditya Gupta reported PowerPC crashes bisected to the blamed commit. Apparently some platforms do not allow prefetch() on arbitrary pointers. prefetch(next); prefetch(&next->priority); // CRASH when next == NULL Only NULL seems to be supported, with specific handling in prefetch(). Add a conditional to avoid the two prefetches and the skb->next clearing for the last skb in the list. Fixes: b2e9821 ("net: prefech skb->priority in __dev_xmit_skb()") Reported-by: Aditya Gupta <adityag@linux.ibm.com> Closes: https://lore.kernel.org/netdev/e9f4abee-b132-440f-a50e-bced0868b5a7@linux.ibm.com/T/#mddc372b64ec5a3b181acc9ee3909110c391cc18a Signed-off-by: Eric Dumazet <edumazet@google.com> Tested-by: Aditya Gupta <adityag@linux.ibm.com> Link: https://patch.msgid.link/20251218081844.809008-1-edumazet@google.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit c04de0c) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent e2bf265 commit c77a500

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

net/core/dev.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4259,9 +4259,11 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
42594259
int count = 0;
42604260

42614261
llist_for_each_entry_safe(skb, next, ll_list, ll_node) {
4262-
prefetch(next);
4263-
prefetch(&next->priority);
4264-
skb_mark_not_on_list(skb);
4262+
if (next) {
4263+
prefetch(next);
4264+
prefetch(&next->priority);
4265+
skb_mark_not_on_list(skb);
4266+
}
42654267
rc = dev_qdisc_enqueue(skb, q, &to_free, txq);
42664268
count++;
42674269
}

0 commit comments

Comments
 (0)