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

Configure Feed

Select the types of activity you want to include in your feed.

net: arp: use kfree_skb_reason() in arp_rcv()

Replace kfree_skb() with kfree_skb_reason() in arp_rcv().

Signed-off-by: Qiu Yutan <qiu.yutan@zte.com.cn>
Signed-off-by: Jiang Kun <jiang.kun2@zte.com.cn>
Link: https://patch.msgid.link/20250612110259698Q2KNNOPQhnIApRskKN3Hi@zte.com.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Qiu Yutan and committed by
Jakub Kicinski
0051ea4a a7075659

+7 -3
+7 -3
net/ipv4/arp.c
··· 966 966 static int arp_rcv(struct sk_buff *skb, struct net_device *dev, 967 967 struct packet_type *pt, struct net_device *orig_dev) 968 968 { 969 + enum skb_drop_reason drop_reason; 969 970 const struct arphdr *arp; 970 971 971 972 /* do not tweak dropwatch on an ARP we will ignore */ ··· 980 979 goto out_of_mem; 981 980 982 981 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ 983 - if (!pskb_may_pull(skb, arp_hdr_len(dev))) 982 + drop_reason = pskb_may_pull_reason(skb, arp_hdr_len(dev)); 983 + if (drop_reason != SKB_NOT_DROPPED_YET) 984 984 goto freeskb; 985 985 986 986 arp = arp_hdr(skb); 987 - if (arp->ar_hln != dev->addr_len || arp->ar_pln != 4) 987 + if (arp->ar_hln != dev->addr_len || arp->ar_pln != 4) { 988 + drop_reason = SKB_DROP_REASON_NOT_SPECIFIED; 988 989 goto freeskb; 990 + } 989 991 990 992 memset(NEIGH_CB(skb), 0, sizeof(struct neighbour_cb)); 991 993 ··· 1000 996 consume_skb(skb); 1001 997 return NET_RX_SUCCESS; 1002 998 freeskb: 1003 - kfree_skb(skb); 999 + kfree_skb_reason(skb, drop_reason); 1004 1000 out_of_mem: 1005 1001 return NET_RX_DROP; 1006 1002 }