Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tcp: use sk_skb_reason_drop to free rx packets

Replace kfree_skb_reason with sk_skb_reason_drop and pass the receiving
socket to the tracepoint.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/r/202406011539.jhwBd7DX-lkp@intel.com/
Signed-off-by: Yan Zhai <yan@cloudflare.com>
Acked-by: Jesper Dangaard Brouer <hawk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Yan Zhai and committed by
David S. Miller
46a02aa3 ce9a2424

+9 -9
+1 -1
net/ipv4/syncookies.c
··· 496 496 out_free: 497 497 reqsk_free(req); 498 498 out_drop: 499 - kfree_skb_reason(skb, reason); 499 + sk_skb_reason_drop(sk, skb, reason); 500 500 return NULL; 501 501 }
+1 -1
net/ipv4/tcp_input.c
··· 4860 4860 enum skb_drop_reason reason) 4861 4861 { 4862 4862 sk_drops_add(sk, skb); 4863 - kfree_skb_reason(skb, reason); 4863 + sk_skb_reason_drop(sk, skb, reason); 4864 4864 } 4865 4865 4866 4866 /* This one checks to see if we can put data from the
+3 -3
net/ipv4/tcp_ipv4.c
··· 1932 1932 reset: 1933 1933 tcp_v4_send_reset(rsk, skb, sk_rst_convert_drop_reason(reason)); 1934 1934 discard: 1935 - kfree_skb_reason(skb, reason); 1935 + sk_skb_reason_drop(sk, skb, reason); 1936 1936 /* Be careful here. If this function gets more complicated and 1937 1937 * gcc suffers from register pressure on the x86, sk (in %ebx) 1938 1938 * might be destroyed here. This current version compiles correctly, ··· 2168 2168 int dif = inet_iif(skb); 2169 2169 const struct iphdr *iph; 2170 2170 const struct tcphdr *th; 2171 + struct sock *sk = NULL; 2171 2172 bool refcounted; 2172 - struct sock *sk; 2173 2173 int ret; 2174 2174 u32 isn; 2175 2175 ··· 2368 2368 discard_it: 2369 2369 SKB_DR_OR(drop_reason, NOT_SPECIFIED); 2370 2370 /* Discard frame. */ 2371 - kfree_skb_reason(skb, drop_reason); 2371 + sk_skb_reason_drop(sk, skb, drop_reason); 2372 2372 return 0; 2373 2373 2374 2374 discard_and_relse:
+1 -1
net/ipv6/syncookies.c
··· 275 275 out_free: 276 276 reqsk_free(req); 277 277 out_drop: 278 - kfree_skb_reason(skb, reason); 278 + sk_skb_reason_drop(sk, skb, reason); 279 279 return NULL; 280 280 }
+3 -3
net/ipv6/tcp_ipv6.c
··· 1674 1674 discard: 1675 1675 if (opt_skb) 1676 1676 __kfree_skb(opt_skb); 1677 - kfree_skb_reason(skb, reason); 1677 + sk_skb_reason_drop(sk, skb, reason); 1678 1678 return 0; 1679 1679 csum_err: 1680 1680 reason = SKB_DROP_REASON_TCP_CSUM; ··· 1747 1747 int dif = inet6_iif(skb); 1748 1748 const struct tcphdr *th; 1749 1749 const struct ipv6hdr *hdr; 1750 + struct sock *sk = NULL; 1750 1751 bool refcounted; 1751 - struct sock *sk; 1752 1752 int ret; 1753 1753 u32 isn; 1754 1754 struct net *net = dev_net(skb->dev); ··· 1940 1940 1941 1941 discard_it: 1942 1942 SKB_DR_OR(drop_reason, NOT_SPECIFIED); 1943 - kfree_skb_reason(skb, drop_reason); 1943 + sk_skb_reason_drop(sk, skb, drop_reason); 1944 1944 return 0; 1945 1945 1946 1946 discard_and_relse: