net: fix sk_buff head without data area
Subsystems (2)
PATCH 1/1 net: fix sk_buff head without data area
Eric Dumazet spotted that we have to check skb->head instead of skb->data as skb->head points to the beginning of the data area of the skbuff. Similarly, we have to initialize the skb->head pointer, not skb->data in __alloc_skb_head.
After this fix, netlink crashes in the release path of the sk_buff, so let's fix that as well.
This bug was introduced in (0ebd0ac net: add function to allocate sk_buff head without data area).
--- net/core/skbuff.c | 4 ++-- net/netlink/af_netlink.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/core/skbuff.c +2 -2
@@ -195,7 +195,7 @@ struct sk_buff *__alloc_skb_head(gfp_t gfp_mask, int node)* the tail pointer in struct sk_buff! */ memset (skb,0 , offsetof(struct sk_buff , tail)); - skb->data =NULL ; + skb->head =NULL ; skb->truesize =sizeof (struct sk_buff );atomic_set (&skb->users,1 );
@@ -611,7 +611,7 @@ static void skb_release_head_state(struct sk_buff *skb)static void skb_release_all (struct sk_buff *skb) {skb_release_head_state (skb); -if (likely (skb->data)) +if (likely (skb->head))skb_release_data (skb); }
net/netlink/af_netlink.c +1 -1
@@ -747,7 +747,7 @@ static void netlink_skb_destructor(struct sk_buff *skb)atomic_dec (&ring->pending);sock_put (sk); - skb->data = NULL; + skb->head = NULL; }#endif if (skb->sk !=NULL )
Signature · 1 line
1.7.10.4
David Miller
maintainerFrom: Pablo Neira Ayuso <[email protected]>
Date: Mon, 3 Jun 2013 21:28:43 +0200
Quoted 5 lines
Eric Dumazet spotted that we have to check
skb->headinstead ofskb->dataasskb->headpoints to the beginning of the data area of the skbuff. Similarly, we have to initialize theskb->headpointer, notskb->datain__alloc_skb_head.
Quoted 8 lines
After this fix, netlink crashes in the release path of the
sk_buff, so let's fix that as well.This bug was introduced in (0ebd0ac net: add function to allocate
sk_buffhead without data area).Reported-by Eric Dumazet <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>
Applied and queued up for -stable, thanks.