Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: avoid prefetching NULL pointers

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: b2e9821cff6c ("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>

authored by

Eric Dumazet and committed by
Paolo Abeni
c04de0c7 f79f9b7a

+5 -3
+5 -3
net/core/dev.c
··· 4241 4241 int count = 0; 4242 4242 4243 4243 llist_for_each_entry_safe(skb, next, ll_list, ll_node) { 4244 - prefetch(next); 4245 - prefetch(&next->priority); 4246 - skb_mark_not_on_list(skb); 4244 + if (next) { 4245 + prefetch(next); 4246 + prefetch(&next->priority); 4247 + skb_mark_not_on_list(skb); 4248 + } 4247 4249 rc = dev_qdisc_enqueue(skb, q, &to_free, txq); 4248 4250 count++; 4249 4251 }