mbox series

[net-next,v3,0/4] net: skb: check the boundrary of skb drop reason

Message ID 20220513030339.336580-1-imagedong@tencent.com (mailing list archive)
Headers show
Series net: skb: check the boundrary of skb drop reason | expand

Message

Menglong Dong May 13, 2022, 3:03 a.m. UTC
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 v2:
1/4 - don't reset the reason and print the debug warning only (Jakub
      Kicinski)
4/4 - remove new lines between tags

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       | 2 ++
 net/ipv4/tcp_ipv4.c     | 1 +
 net/ipv6/tcp_ipv6.c     | 1 +
 5 files changed, 7 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org May 16, 2022, 10 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 13 May 2022 11:03:35 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net-next,v3,1/4] net: dm: check the boundary of skb drop reasons
    https://git.kernel.org/netdev/net-next/c/a3af33abd921
  - [net-next,v3,2/4] net: skb: check the boundrary of drop reason in kfree_skb_reason()
    https://git.kernel.org/netdev/net-next/c/20bbcd0a94c6
  - [net-next,v3,3/4] net: skb: change the definition SKB_DR_SET()
    https://git.kernel.org/netdev/net-next/c/7ebd3f3ee51a
  - [net-next,v3,4/4] net: tcp: reset 'drop_reason' to NOT_SPCIFIED in tcp_v{4,6}_rcv()
    https://git.kernel.org/netdev/net-next/c/f8319dfd1b3b

You are awesome, thank you!