Commit 64935310 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 7fa4bd73 682ec859
...@@ -3938,16 +3938,6 @@ static inline void skb_ext_put(struct sk_buff *skb) ...@@ -3938,16 +3938,6 @@ static inline void skb_ext_put(struct sk_buff *skb)
__skb_ext_put(skb->extensions); __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, static inline void __skb_ext_copy(struct sk_buff *dst,
const struct sk_buff *src) 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) ...@@ -3995,7 +3985,6 @@ static inline void *skb_ext_find(const struct sk_buff *skb, enum skb_ext_id id)
} }
#else #else
static inline void skb_ext_put(struct sk_buff *skb) {} 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_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 *d, const struct sk_buff *s) {}
static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {} static inline void skb_ext_copy(struct sk_buff *dst, const struct sk_buff *s) {}
......
...@@ -5666,13 +5666,10 @@ void *skb_ext_add(struct sk_buff *skb, enum skb_ext_id id) ...@@ -5666,13 +5666,10 @@ void *skb_ext_add(struct sk_buff *skb, enum skb_ext_id id)
if (!new) if (!new)
return NULL; return NULL;
if (__skb_ext_exist(old, id)) { if (__skb_ext_exist(new, id))
if (old != new)
skb->extensions = new;
goto set_active; goto set_active;
}
newoff = old->chunks; newoff = new->chunks;
} else { } else {
newoff = SKB_EXT_CHUNKSIZEOF(*new); newoff = SKB_EXT_CHUNKSIZEOF(*new);
...@@ -5684,8 +5681,8 @@ void *skb_ext_add(struct sk_buff *skb, enum skb_ext_id id) ...@@ -5684,8 +5681,8 @@ void *skb_ext_add(struct sk_buff *skb, enum skb_ext_id id)
newlen = newoff + skb_ext_type_len[id]; newlen = newoff + skb_ext_type_len[id];
new->chunks = newlen; new->chunks = newlen;
new->offset[id] = newoff; new->offset[id] = newoff;
skb->extensions = new;
set_active: set_active:
skb->extensions = new;
skb->active_extensions |= 1 << id; skb->active_extensions |= 1 << id;
return skb_ext_get_ptr(new, id); return skb_ext_get_ptr(new, id);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment