diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2014-04-01 15:20:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-01 17:53:36 -0400 |
commit | 574f7194f693cd80de96a39f0c43dbb346c38a15 (patch) | |
tree | e4a288169c3df023a77a70bc2538da2f3148792e | |
parent | f91ca783f11029940aa60a9a5aad4dce666e6414 (diff) |
net: Add a test to see if a skb is freeable in irq context
Currently netpoll and skb_release_head_state assume that a skb is
freeable in hard irq context except when skb->destructor is set.
The reality is far from this. So add a function skb_irq_freeable to
compute the full test and in the process be the living documentation
of what the requirements are of actually freeing a skb in hard irq
context.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/skbuff.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 31edf63937a1..350eebe770d9 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -2831,6 +2831,19 @@ static inline void skb_init_secmark(struct sk_buff *skb) | |||
2831 | { } | 2831 | { } |
2832 | #endif | 2832 | #endif |
2833 | 2833 | ||
2834 | static inline bool skb_irq_freeable(const struct sk_buff *skb) | ||
2835 | { | ||
2836 | return !skb->destructor && | ||
2837 | #if IS_ENABLED(CONFIG_XFRM) | ||
2838 | !skb->sp && | ||
2839 | #endif | ||
2840 | #if IS_ENABLED(CONFIG_NF_CONNTRACK) | ||
2841 | !skb->nfct && | ||
2842 | #endif | ||
2843 | !skb->_skb_refdst && | ||
2844 | !skb_has_frag_list(skb); | ||
2845 | } | ||
2846 | |||
2834 | static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) | 2847 | static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) |
2835 | { | 2848 | { |
2836 | skb->queue_mapping = queue_mapping; | 2849 | skb->queue_mapping = queue_mapping; |