]> git.baikalelectronics.ru Git - kernel.git/commit
net: skb: check the boundrary of drop reason in kfree_skb_reason()
authorMenglong Dong <imagedong@tencent.com>
Fri, 13 May 2022 03:03:37 +0000 (11:03 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 May 2022 09:47:43 +0000 (10:47 +0100)
commite96ac0a3ac17280d0cdd8f0f4ac29adb46a95cfe
treeb86d8d7397c28d81f75992c97872be842ee3a092
parentb5149f0506bb677ae1130a9e442284d0a697bc48
net: skb: check the boundrary of drop reason in kfree_skb_reason()

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@tencent.com>
Reviewed-by: Hao Peng <flyingpeng@tencent.com>
Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c