net: raw: 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. 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
7467de1763
commit
ce9a2424e9
@ -301,7 +301,7 @@ static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
ipv4_pktinfo_prepare(sk, skb, true);
|
||||
if (sock_queue_rcv_skb_reason(sk, skb, &reason) < 0) {
|
||||
kfree_skb_reason(skb, reason);
|
||||
sk_skb_reason_drop(sk, skb, reason);
|
||||
return NET_RX_DROP;
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
{
|
||||
if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) {
|
||||
atomic_inc(&sk->sk_drops);
|
||||
kfree_skb_reason(skb, SKB_DROP_REASON_XFRM_POLICY);
|
||||
sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_XFRM_POLICY);
|
||||
return NET_RX_DROP;
|
||||
}
|
||||
nf_reset_ct(skb);
|
||||
|
@ -362,14 +362,14 @@ static inline int rawv6_rcv_skb(struct sock *sk, struct sk_buff *skb)
|
||||
if ((raw6_sk(sk)->checksum || rcu_access_pointer(sk->sk_filter)) &&
|
||||
skb_checksum_complete(skb)) {
|
||||
atomic_inc(&sk->sk_drops);
|
||||
kfree_skb_reason(skb, SKB_DROP_REASON_SKB_CSUM);
|
||||
sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_SKB_CSUM);
|
||||
return NET_RX_DROP;
|
||||
}
|
||||
|
||||
/* Charge it to the socket. */
|
||||
skb_dst_drop(skb);
|
||||
if (sock_queue_rcv_skb_reason(sk, skb, &reason) < 0) {
|
||||
kfree_skb_reason(skb, reason);
|
||||
sk_skb_reason_drop(sk, skb, reason);
|
||||
return NET_RX_DROP;
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) {
|
||||
atomic_inc(&sk->sk_drops);
|
||||
kfree_skb_reason(skb, SKB_DROP_REASON_XFRM_POLICY);
|
||||
sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_XFRM_POLICY);
|
||||
return NET_RX_DROP;
|
||||
}
|
||||
nf_reset_ct(skb);
|
||||
@ -415,7 +415,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
|
||||
if (inet_test_bit(HDRINCL, sk)) {
|
||||
if (skb_checksum_complete(skb)) {
|
||||
atomic_inc(&sk->sk_drops);
|
||||
kfree_skb_reason(skb, SKB_DROP_REASON_SKB_CSUM);
|
||||
sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_SKB_CSUM);
|
||||
return NET_RX_DROP;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user