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, 13 May 2022 11:03:37 +0800 From: menglong8.dong@...il.com To: kuba@...nel.org Cc: nhorman@...driver.com, davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com, yoshfuji@...ux-ipv6.org, dsahern@...nel.org, imagedong@...cent.com, kafai@...com, talalahmad@...gle.com, keescook@...omium.org, asml.silence@...il.com, willemb@...gle.com, vasily.averin@...ux.dev, ilias.apalodimas@...aro.org, luiz.von.dentz@...el.com, linux-kernel@...r.kernel.org, netdev@...r.kernel.org, Jiang Biao <benbjiang@...cent.com>, Hao Peng <flyingpeng@...cent.com> Subject: [PATCH net-next v3 2/4] net: skb: check the boundrary of drop reason in kfree_skb_reason() From: Menglong Dong <imagedong@...cent.com> Sometimes, we may forget to reset skb drop reason to NOT_SPECIFIED after we make it the return value of the functions with return type of enum skb_drop_reason, such as tcp_inbound_md5_hash. Therefore, its value can be SKB_NOT_DROPPED_YET(0), which is invalid for kfree_skb_reason(). So we check the range of drop reason in kfree_skb_reason() with DEBUG_NET_WARN_ON_ONCE(). Reviewed-by: Jiang Biao <benbjiang@...cent.com> Reviewed-by: Hao Peng <flyingpeng@...cent.com> Signed-off-by: Menglong Dong <imagedong@...cent.com> --- v3: - don't reset the reason and print the debug warning only (Jakub Kicinski) --- net/core/skbuff.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 15f7b6f99a8f..fab791b0c59e 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -771,6 +771,8 @@ void kfree_skb_reason(struct sk_buff *skb, enum skb_drop_reason reason) if (!skb_unref(skb)) return; + DEBUG_NET_WARN_ON_ONCE(reason <= 0 || reason >= SKB_DROP_REASON_MAX); + trace_kfree_skb(skb, __builtin_return_address(0), reason); __kfree_skb(skb); } -- 2.36.1
Powered by blists - more mailing lists