mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
udp: 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/202406011751.NpVN0sSk-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>
This commit is contained in:
parent
46a02aa357
commit
fc0cc92488
@ -2074,7 +2074,7 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
||||
}
|
||||
UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
|
||||
trace_udp_fail_queue_rcv_skb(rc, sk, skb);
|
||||
kfree_skb_reason(skb, drop_reason);
|
||||
sk_skb_reason_drop(sk, skb, drop_reason);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2196,7 +2196,7 @@ csum_error:
|
||||
drop:
|
||||
__UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
|
||||
atomic_inc(&sk->sk_drops);
|
||||
kfree_skb_reason(skb, drop_reason);
|
||||
sk_skb_reason_drop(sk, skb, drop_reason);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2383,7 +2383,7 @@ static int udp_unicast_rcv_skb(struct sock *sk, struct sk_buff *skb,
|
||||
int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
|
||||
int proto)
|
||||
{
|
||||
struct sock *sk;
|
||||
struct sock *sk = NULL;
|
||||
struct udphdr *uh;
|
||||
unsigned short ulen;
|
||||
struct rtable *rt = skb_rtable(skb);
|
||||
@ -2460,7 +2460,7 @@ no_sk:
|
||||
* Hmm. We got an UDP packet to a port to which we
|
||||
* don't wanna listen. Ignore it.
|
||||
*/
|
||||
kfree_skb_reason(skb, drop_reason);
|
||||
sk_skb_reason_drop(sk, skb, drop_reason);
|
||||
return 0;
|
||||
|
||||
short_packet:
|
||||
@ -2485,7 +2485,7 @@ csum_error:
|
||||
__UDP_INC_STATS(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE);
|
||||
drop:
|
||||
__UDP_INC_STATS(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
|
||||
kfree_skb_reason(skb, drop_reason);
|
||||
sk_skb_reason_drop(sk, skb, drop_reason);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -673,7 +673,7 @@ static int __udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
||||
}
|
||||
UDP6_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
|
||||
trace_udp_fail_queue_rcv_skb(rc, sk, skb);
|
||||
kfree_skb_reason(skb, drop_reason);
|
||||
sk_skb_reason_drop(sk, skb, drop_reason);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -776,7 +776,7 @@ csum_error:
|
||||
drop:
|
||||
__UDP6_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
|
||||
atomic_inc(&sk->sk_drops);
|
||||
kfree_skb_reason(skb, drop_reason);
|
||||
sk_skb_reason_drop(sk, skb, drop_reason);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -940,8 +940,8 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
|
||||
enum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED;
|
||||
const struct in6_addr *saddr, *daddr;
|
||||
struct net *net = dev_net(skb->dev);
|
||||
struct sock *sk = NULL;
|
||||
struct udphdr *uh;
|
||||
struct sock *sk;
|
||||
bool refcounted;
|
||||
u32 ulen = 0;
|
||||
|
||||
@ -1033,7 +1033,7 @@ no_sk:
|
||||
__UDP6_INC_STATS(net, UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE);
|
||||
icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
|
||||
|
||||
kfree_skb_reason(skb, reason);
|
||||
sk_skb_reason_drop(sk, skb, reason);
|
||||
return 0;
|
||||
|
||||
short_packet:
|
||||
@ -1054,7 +1054,7 @@ csum_error:
|
||||
__UDP6_INC_STATS(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE);
|
||||
discard:
|
||||
__UDP6_INC_STATS(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
|
||||
kfree_skb_reason(skb, reason);
|
||||
sk_skb_reason_drop(sk, skb, reason);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user