lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 4 Mar 2022 01:47:07 +0800 From: menglong8.dong@...il.com To: dsahern@...nel.org, kuba@...nel.org Cc: rostedt@...dmis.org, mingo@...hat.com, davem@...emloft.net, ast@...nel.org, daniel@...earbox.net, hawk@...nel.org, john.fastabend@...il.com, imagedong@...cent.com, edumazet@...gle.com, talalahmad@...gle.com, keescook@...omium.org, ilias.apalodimas@...aro.org, alobakin@...me, flyingpeng@...cent.com, mengensun@...cent.com, atenart@...nel.org, bigeasy@...utronix.de, memxor@...il.com, arnd@...db.de, pabeni@...hat.com, willemb@...gle.com, vvs@...tuozzo.com, cong.wang@...edance.com, linux-kernel@...r.kernel.org, netdev@...r.kernel.org, bpf@...r.kernel.org Subject: [PATCH net-next 7/7] net: dev: use kfree_skb_reason() for __netif_receive_skb_core() From: Menglong Dong <imagedong@...cent.com> Add reason for skb drops to __netif_receive_skb_core() when packet_type not found to handle the skb. For this purpose, the drop reason SKB_DROP_REASON_PTYPE_ABSENT is introduced. Take ether packets for example, this case mainly happens when L3 protocol is not supported. Signed-off-by: Menglong Dong <imagedong@...cent.com> --- include/linux/skbuff.h | 5 +++++ net/core/dev.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 04508d15152e..f3945d21cecf 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -413,6 +413,11 @@ enum skb_drop_reason { * failed (maybe an eBPF program * is tricking?) */ + SKB_DROP_REASON_PTYPE_ABSENT, /* not packet_type found to handle + * the skb. For an etner packet, + * this means that L3 protocol is + * not supported + */ SKB_DROP_REASON_MAX, }; diff --git a/net/core/dev.c b/net/core/dev.c index 429ad8265e8c..0bdea7d113f5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5330,11 +5330,13 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc, *ppt_prev = pt_prev; } else { drop: - if (!deliver_exact) + if (!deliver_exact) { atomic_long_inc(&skb->dev->rx_dropped); - else + kfree_skb_reason(skb, SKB_DROP_REASON_PTYPE_ABSENT); + } else { atomic_long_inc(&skb->dev->rx_nohandler); - kfree_skb(skb); + kfree_skb(skb); + } /* Jamal, now you will not able to escape explaining * me how you were going to use this. :-) */ -- 2.35.1
Powered by blists - more mailing lists