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

Merge branch 'skb_ext-fixes'

Paolo Abeni says:

====================
net: skb extension follow-ups

This series includes some follow-up for the recently added skb extension.
The first patch addresses an unlikely race while adding skb extensions,
and the following two are just minor code clean-up.

v1 -> v2:
- be sure to flag the newly added extension as active in skb_ext_add()
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+3 -17
-11
include/linux/skbuff.h
··· 3938 3938 __skb_ext_put(skb->extensions); 3939 3939 } 3940 3940 3941 - static inline void skb_ext_get(struct sk_buff *skb) 3942 - { 3943 - if (skb->active_extensions) { 3944 - struct skb_ext *ext = skb->extensions; 3945 - 3946 - if (ext) 3947 - refcount_inc(&ext->refcnt); 3948 - } 3949 - } 3950 - 3951 3941 static inline void __skb_ext_copy(struct sk_buff *dst, 3952 3942 const struct sk_buff *src) 3953 3943 { ··· 3985 3995 } 3986 3996 #else 3987 3997 static inline void skb_ext_put(struct sk_buff *skb) {} 3988 - static inline void skb_ext_get(struct sk_buff *skb) {} 3989 3998 static inline void skb_ext_del(struct sk_buff *skb, int unused) {} 3990 3999 static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {} 3991 4000 static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {}
+3 -6
net/core/skbuff.c
··· 5666 5666 if (!new) 5667 5667 return NULL; 5668 5668 5669 - if (__skb_ext_exist(old, id)) { 5670 - if (old != new) 5671 - skb->extensions = new; 5669 + if (__skb_ext_exist(new, id)) 5672 5670 goto set_active; 5673 - } 5674 5671 5675 - newoff = old->chunks; 5672 + newoff = new->chunks; 5676 5673 } else { 5677 5674 newoff = SKB_EXT_CHUNKSIZEOF(*new); 5678 5675 ··· 5681 5684 newlen = newoff + skb_ext_type_len[id]; 5682 5685 new->chunks = newlen; 5683 5686 new->offset[id] = newoff; 5684 - skb->extensions = new; 5685 5687 set_active: 5688 + skb->extensions = new; 5686 5689 skb->active_extensions |= 1 << id; 5687 5690 return skb_ext_get_ptr(new, id); 5688 5691 }