Skip to content

Commit 3a0f9f0

Browse files
committed
tcp: use sk_skb_reason_drop to free rx packets
JIRA: https://issues.redhat.com/browse/RHEL-48648 Upstream Status: net-next.git commit 46a02aa Author: Yan Zhai <yan@cloudflare.com> Date: Mon Jun 17 11:09:20 2024 -0700 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> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent dff30fe commit 3a0f9f0

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

net/ipv4/syncookies.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,6 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
457457
out_free:
458458
reqsk_free(req);
459459
out_drop:
460-
kfree_skb_reason(skb, reason);
460+
sk_skb_reason_drop(sk, skb, reason);
461461
return NULL;
462462
}

net/ipv4/tcp_input.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4705,7 +4705,7 @@ static void tcp_drop_reason(struct sock *sk, struct sk_buff *skb,
47054705
enum skb_drop_reason reason)
47064706
{
47074707
sk_drops_add(sk, skb);
4708-
kfree_skb_reason(skb, reason);
4708+
sk_skb_reason_drop(sk, skb, reason);
47094709
}
47104710

47114711
/* This one checks to see if we can put data from the

net/ipv4/tcp_ipv4.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
16911691
reset:
16921692
tcp_v4_send_reset(rsk, skb, sk_rst_convert_drop_reason(reason));
16931693
discard:
1694-
kfree_skb_reason(skb, reason);
1694+
sk_skb_reason_drop(sk, skb, reason);
16951695
/* Be careful here. If this function gets more complicated and
16961696
* gcc suffers from register pressure on the x86, sk (in %ebx)
16971697
* might be destroyed here. This current version compiles correctly,
@@ -1920,8 +1920,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
19201920
int dif = inet_iif(skb);
19211921
const struct iphdr *iph;
19221922
const struct tcphdr *th;
1923+
struct sock *sk = NULL;
19231924
bool refcounted;
1924-
struct sock *sk;
19251925
int ret;
19261926

19271927
drop_reason = SKB_DROP_REASON_NOT_SPECIFIED;
@@ -2115,7 +2115,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
21152115
discard_it:
21162116
SKB_DR_OR(drop_reason, NOT_SPECIFIED);
21172117
/* Discard frame. */
2118-
kfree_skb_reason(skb, drop_reason);
2118+
sk_skb_reason_drop(sk, skb, drop_reason);
21192119
return 0;
21202120

21212121
discard_and_relse:

net/ipv6/syncookies.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,6 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
273273
out_free:
274274
reqsk_free(req);
275275
out_drop:
276-
kfree_skb_reason(skb, reason);
276+
sk_skb_reason_drop(sk, skb, reason);
277277
return NULL;
278278
}

net/ipv6/tcp_ipv6.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
15161516
discard:
15171517
if (opt_skb)
15181518
__kfree_skb(opt_skb);
1519-
kfree_skb_reason(skb, reason);
1519+
sk_skb_reason_drop(sk, skb, reason);
15201520
return 0;
15211521
csum_err:
15221522
reason = SKB_DROP_REASON_TCP_CSUM;
@@ -1589,8 +1589,8 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
15891589
int dif = inet6_iif(skb);
15901590
const struct tcphdr *th;
15911591
const struct ipv6hdr *hdr;
1592+
struct sock *sk = NULL;
15921593
bool refcounted;
1593-
struct sock *sk;
15941594
int ret;
15951595
struct net *net = dev_net(skb->dev);
15961596

@@ -1771,7 +1771,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
17711771

17721772
discard_it:
17731773
SKB_DR_OR(drop_reason, NOT_SPECIFIED);
1774-
kfree_skb_reason(skb, drop_reason);
1774+
sk_skb_reason_drop(sk, skb, drop_reason);
17751775
return 0;
17761776

17771777
discard_and_relse:

0 commit comments

Comments
 (0)