2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-26 22:24:09 +08:00

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>
This commit is contained in:
David S. Miller 2018-12-21 10:24:54 -08:00
commit 64935310f2
2 changed files with 3 additions and 17 deletions

View File

@ -3938,16 +3938,6 @@ static inline void skb_ext_put(struct sk_buff *skb)
__skb_ext_put(skb->extensions);
}
static inline void skb_ext_get(struct sk_buff *skb)
{
if (skb->active_extensions) {
struct skb_ext *ext = skb->extensions;
if (ext)
refcount_inc(&ext->refcnt);
}
}
static inline void __skb_ext_copy(struct sk_buff *dst,
const struct sk_buff *src)
{
@ -3995,7 +3985,6 @@ static inline void *skb_ext_find(const struct sk_buff *skb, enum skb_ext_id id)
}
#else
static inline void skb_ext_put(struct sk_buff *skb) {}
static inline void skb_ext_get(struct sk_buff *skb) {}
static inline void skb_ext_del(struct sk_buff *skb, int unused) {}
static inline void __skb_ext_copy(struct sk_buff *d, const struct sk_buff *s) {}
static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {}

View File

@ -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);
}