linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/4] net: skb: check the boundrary of skb drop reason
@ 2022-05-12 12:33 menglong8.dong
  2022-05-12 12:33 ` [PATCH net-next v2 1/4] net: dm: check the boundary of skb drop reasons menglong8.dong
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: menglong8.dong @ 2022-05-12 12:33 UTC (permalink / raw)
  To: kuba
  Cc: nhorman, davem, edumazet, pabeni, yoshfuji, dsahern, imagedong,
	kafai, talalahmad, keescook, asml.silence, willemb,
	vasily.averin, ilias.apalodimas, luiz.von.dentz, linux-kernel,
	netdev

From: Menglong Dong <imagedong@tencent.com>

In the commit 1330b6ef3313 ("skb: make drop reason booleanable"),
SKB_NOT_DROPPED_YET is added to the enum skb_drop_reason, which makes
the invalid drop reason SKB_NOT_DROPPED_YET can leak to the kfree_skb
tracepoint. Once this happen (it happened, as 4th patch says), it can
cause NULL pointer in drop monitor and result in kernel panic.

Therefore, check the boundrary of drop reason in both kfree_skb_reason
(2th patch) and drop monitor (1th patch) to prevent such case happens
again.

Meanwhile, fix the invalid drop reason passed to kfree_skb_reason() in
tcp_v4_rcv() and tcp_v6_rcv().

Changes since v1:
- consider tcp_v6_rcv() in the 4th patch

Menglong Dong (4):
  net: dm: check the boundary of skb drop reasons
  net: skb: check the boundrary of drop reason in kfree_skb_reason()
  net: skb: change the definition SKB_DR_SET()
  net: tcp: reset 'drop_reason' to NOT_SPCIFIED in tcp_v{4,6}_rcv()

 include/linux/skbuff.h  | 3 ++-
 net/core/drop_monitor.c | 2 +-
 net/core/skbuff.c       | 5 +++++
 net/ipv4/tcp_ipv4.c     | 1 +
 net/ipv6/tcp_ipv6.c     | 1 +
 5 files changed, 10 insertions(+), 2 deletions(-)

-- 
2.36.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-13  2:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 12:33 [PATCH net-next v2 0/4] net: skb: check the boundrary of skb drop reason menglong8.dong
2022-05-12 12:33 ` [PATCH net-next v2 1/4] net: dm: check the boundary of skb drop reasons menglong8.dong
2022-05-12 12:33 ` [PATCH net-next v2 2/4] net: skb: check the boundrary of drop reason in kfree_skb_reason() menglong8.dong
2022-05-12 16:15   ` Jakub Kicinski
2022-05-12 16:16     ` Eric Dumazet
2022-05-13  2:41     ` Menglong Dong
2022-05-12 12:33 ` [PATCH net-next v2 3/4] net: skb: change the definition SKB_DR_SET() menglong8.dong
2022-05-12 12:33 ` [PATCH net-next v2 4/4] net: tcp: reset 'drop_reason' to NOT_SPCIFIED in tcp_v{4,6}_rcv() menglong8.dong
2022-05-12 16:16   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).