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>
This commit is contained in:
David S. Miller 2018-07-31 15:27:56 -07:00
parent a8305bff68
commit 992cba7e27
3 changed files with 9 additions and 9 deletions

View File

@ -1344,6 +1344,12 @@ static inline void skb_mark_not_on_list(struct sk_buff *skb)
skb->next = NULL; skb->next = NULL;
} }
static inline void skb_list_del_init(struct sk_buff *skb)
{
__list_del_entry(&skb->list);
skb_mark_not_on_list(skb);
}
/** /**
* skb_queue_empty - check if a queue is empty * skb_queue_empty - check if a queue is empty
* @list: queue head * @list: queue head

View File

@ -5295,8 +5295,7 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index,
list_for_each_entry_safe_reverse(skb, p, head, list) { list_for_each_entry_safe_reverse(skb, p, head, list) {
if (flush_old && NAPI_GRO_CB(skb)->age == jiffies) if (flush_old && NAPI_GRO_CB(skb)->age == jiffies)
return; return;
list_del(&skb->list); skb_list_del_init(skb);
skb_mark_not_on_list(skb);
napi_gro_complete(skb); napi_gro_complete(skb);
napi->gro_hash[index].count--; napi->gro_hash[index].count--;
} }
@ -5481,8 +5480,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
ret = NAPI_GRO_CB(skb)->free ? GRO_MERGED_FREE : GRO_MERGED; ret = NAPI_GRO_CB(skb)->free ? GRO_MERGED_FREE : GRO_MERGED;
if (pp) { if (pp) {
list_del(&pp->list); skb_list_del_init(pp);
skb_mark_not_on_list(pp);
napi_gro_complete(pp); napi_gro_complete(pp);
napi->gro_hash[hash].count--; napi->gro_hash[hash].count--;
} }

View File

@ -531,11 +531,7 @@ static void ip_sublist_rcv_finish(struct list_head *head)
struct sk_buff *skb, *next; struct sk_buff *skb, *next;
list_for_each_entry_safe(skb, next, head, list) { list_for_each_entry_safe(skb, next, head, list) {
list_del(&skb->list); skb_list_del_init(skb);
/* Handle ip{6}_forward case, as sch_direct_xmit have
* another kind of SKB-list usage (see validate_xmit_skb_list)
*/
skb_mark_not_on_list(skb);
dst_input(skb); dst_input(skb);
} }
} }