Skip to content

Commit 992cba7

Browse files
committed
net: Add and use skb_list_del_init().
It documents what is happening, and eliminates the spurious list pointer poisoning. In the long term, in order to get proper list head debugging, we might want to use the list poison value as the indicator that an SKB is a singleton and not on a list. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a8305bf commit 992cba7

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

include/linux/skbuff.h

+6
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,12 @@ static inline void skb_mark_not_on_list(struct sk_buff *skb)
13441344
skb->next = NULL;
13451345
}
13461346

1347+
static inline void skb_list_del_init(struct sk_buff *skb)
1348+
{
1349+
__list_del_entry(&skb->list);
1350+
skb_mark_not_on_list(skb);
1351+
}
1352+
13471353
/**
13481354
* skb_queue_empty - check if a queue is empty
13491355
* @list: queue head

net/core/dev.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -5295,8 +5295,7 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index,
52955295
list_for_each_entry_safe_reverse(skb, p, head, list) {
52965296
if (flush_old && NAPI_GRO_CB(skb)->age == jiffies)
52975297
return;
5298-
list_del(&skb->list);
5299-
skb_mark_not_on_list(skb);
5298+
skb_list_del_init(skb);
53005299
napi_gro_complete(skb);
53015300
napi->gro_hash[index].count--;
53025301
}
@@ -5481,8 +5480,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
54815480
ret = NAPI_GRO_CB(skb)->free ? GRO_MERGED_FREE : GRO_MERGED;
54825481

54835482
if (pp) {
5484-
list_del(&pp->list);
5485-
skb_mark_not_on_list(pp);
5483+
skb_list_del_init(pp);
54865484
napi_gro_complete(pp);
54875485
napi->gro_hash[hash].count--;
54885486
}

net/ipv4/ip_input.c

+1-5
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,7 @@ static void ip_sublist_rcv_finish(struct list_head *head)
531531
struct sk_buff *skb, *next;
532532

533533
list_for_each_entry_safe(skb, next, head, list) {
534-
list_del(&skb->list);
535-
/* Handle ip{6}_forward case, as sch_direct_xmit have
536-
* another kind of SKB-list usage (see validate_xmit_skb_list)
537-
*/
538-
skb_mark_not_on_list(skb);
534+
skb_list_del_init(skb);
539535
dst_input(skb);
540536
}
541537
}

0 commit comments

Comments
 (0)