forked from TencentOS/TencentOS-kernel
Merge pull request #256 from xmmgithub/tk4/master
net: skb: prevent the split of kfree_skb_reason() by gcc
This commit is contained in:
commit
213d7cc512
|
|
@ -270,4 +270,11 @@
|
|||
*/
|
||||
#define __weak __attribute__((__weak__))
|
||||
|
||||
/*
|
||||
* Used by functions that use '__builtin_return_address'. These function
|
||||
* don't want to be splited or made inline, which can make
|
||||
* the '__builtin_return_address' get unexpected address.
|
||||
*/
|
||||
#define __fix_address noinline __noclone
|
||||
|
||||
#endif /* __LINUX_COMPILER_ATTRIBUTES_H */
|
||||
|
|
|
|||
|
|
@ -1018,7 +1018,8 @@ static inline bool skb_unref(struct sk_buff *skb)
|
|||
return true;
|
||||
}
|
||||
|
||||
void kfree_skb_reason(struct sk_buff *skb, enum skb_drop_reason reason);
|
||||
void __fix_address
|
||||
kfree_skb_reason(struct sk_buff *skb, enum skb_drop_reason reason);
|
||||
|
||||
/**
|
||||
* kfree_skb - free an sk_buff with 'NOT_SPECIFIED' reason
|
||||
|
|
|
|||
|
|
@ -703,9 +703,10 @@ EXPORT_SYMBOL(__kfree_skb);
|
|||
* hit zero. Meanwhile, pass the drop reason to 'kfree_skb'
|
||||
* tracepoint.
|
||||
*/
|
||||
void kfree_skb_reason(struct sk_buff *skb, enum skb_drop_reason reason)
|
||||
void __fix_address
|
||||
kfree_skb_reason(struct sk_buff *skb, enum skb_drop_reason reason)
|
||||
{
|
||||
if (!skb_unref(skb))
|
||||
if (unlikely(!skb_unref(skb)))
|
||||
return;
|
||||
|
||||
WARN_ON_ONCE(reason <= 0 || reason >= SKB_DROP_REASON_MAX);
|
||||
|
|
|
|||
Loading…
Reference in New Issue