diff options
author | David S. Miller <davem@davemloft.net> | 2018-12-21 10:24:54 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-21 10:24:54 -0800 |
commit | 64935310f2fc0128373bbbcfb5b8b49fd26e2ae8 (patch) | |
tree | 11fb43824d249c87afe417bef0b9c372077972b4 /net/core | |
parent | 7fa4bd739fc0fa209fa5120383aab17f6e9600f7 (diff) | |
parent | 682ec859518d73435cc924d816da2953343241c1 (diff) | |
download | lwn-64935310f2fc0128373bbbcfb5b8b49fd26e2ae8.tar.gz lwn-64935310f2fc0128373bbbcfb5b8b49fd26e2ae8.zip |
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>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/skbuff.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index cb0bf4215745..37317ffec146 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -5666,13 +5666,10 @@ void *skb_ext_add(struct sk_buff *skb, enum skb_ext_id id) if (!new) return NULL; - if (__skb_ext_exist(old, id)) { - if (old != new) - skb->extensions = new; + if (__skb_ext_exist(new, id)) goto set_active; - } - newoff = old->chunks; + newoff = new->chunks; } else { newoff = SKB_EXT_CHUNKSIZEOF(*new); @@ -5684,8 +5681,8 @@ void *skb_ext_add(struct sk_buff *skb, enum skb_ext_id id) newlen = newoff + skb_ext_type_len[id]; new->chunks = newlen; new->offset[id] = newoff; - skb->extensions = new; set_active: + skb->extensions = new; skb->active_extensions |= 1 << id; return skb_ext_get_ptr(new, id); } |