[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220220070637.162720-3-imagedong@tencent.com>
Date: Sun, 20 Feb 2022 15:06:30 +0800
From: menglong8.dong@...il.com
To: dsahern@...nel.org, kuba@...nel.org
Cc: edumazet@...gle.com, davem@...emloft.net, rostedt@...dmis.org,
mingo@...hat.com, yoshfuji@...ux-ipv6.org, ast@...nel.org,
daniel@...earbox.net, hawk@...nel.org, john.fastabend@...il.com,
imagedong@...cent.com, talalahmad@...gle.com,
keescook@...omium.org, ilias.apalodimas@...aro.org, alobakin@...me,
memxor@...il.com, atenart@...nel.org, bigeasy@...utronix.de,
pabeni@...hat.com, linyunsheng@...wei.com, arnd@...db.de,
yajun.deng@...ux.dev, roopa@...dia.com, willemb@...gle.com,
vvs@...tuozzo.com, cong.wang@...edance.com,
luiz.von.dentz@...el.com, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, bpf@...r.kernel.org,
flyingpeng@...cent.com, mengensun@...cent.com
Subject: [PATCH net-next v3 2/9] net: tcp: add skb drop reasons to tcp_v4_rcv()
From: Menglong Dong <imagedong@...cent.com>
Use kfree_skb_reason() for some path in tcp_v4_rcv() that missed before,
including:
SKB_DROP_REASON_SOCKET_FILTER
SKB_DROP_REASON_XFRM_POLICY
Reviewed-by: Mengen Sun <mengensun@...cent.com>
Reviewed-by: Hao Peng <flyingpeng@...cent.com>
Signed-off-by: Menglong Dong <imagedong@...cent.com>
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Reviewed-by: David Ahern <dsahern@...nel.org>
---
v2:
- let NO_SOCKET trump the XFRM failure
---
net/ipv4/tcp_ipv4.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 6873f46fc8ba..a3beab01e9a7 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2057,6 +2057,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
iph = ip_hdr(skb);
tcp_v4_fill_cb(skb, iph, th);
nsk = tcp_check_req(sk, skb, req, false, &req_stolen);
+ } else {
+ drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
}
if (!nsk) {
reqsk_put(req);
@@ -2092,8 +2094,10 @@ int tcp_v4_rcv(struct sk_buff *skb)
}
}
- if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
+ if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) {
+ drop_reason = SKB_DROP_REASON_XFRM_POLICY;
goto discard_and_relse;
+ }
if (tcp_v4_inbound_md5_hash(sk, skb, dif, sdif))
goto discard_and_relse;
@@ -2166,6 +2170,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
do_time_wait:
if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
+ drop_reason = SKB_DROP_REASON_XFRM_POLICY;
inet_twsk_put(inet_twsk(sk));
goto discard_it;
}
--
2.35.1
Powered by blists - more mailing lists