Skip to content

Commit e45b719

Browse files
Qiu Yutandavem330
authored andcommitted
net: neigh: use kfree_skb_reason() in neigh_resolve_output() and neigh_connected_output()
Replace kfree_skb() used in neigh_resolve_output() and neigh_connected_output() with kfree_skb_reason(). Following new skb drop reason is added: /* failed to fill the device hard header */ SKB_DROP_REASON_NEIGH_HH_FILLFAIL Signed-off-by: Qiu Yutan <[email protected]> Signed-off-by: Jiang Kun <[email protected]> Reviewed-by: Kuniyuki Iwashima <[email protected]> Reviewed-by: Xu Xin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8ceeef2 commit e45b719

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/net/dropreason-core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
FN(NEIGH_FAILED) \
6363
FN(NEIGH_QUEUEFULL) \
6464
FN(NEIGH_DEAD) \
65+
FN(NEIGH_HH_FILLFAIL) \
6566
FN(TC_EGRESS) \
6667
FN(SECURITY_HOOK) \
6768
FN(QDISC_DROP) \
@@ -348,6 +349,8 @@ enum skb_drop_reason {
348349
SKB_DROP_REASON_NEIGH_QUEUEFULL,
349350
/** @SKB_DROP_REASON_NEIGH_DEAD: neigh entry is dead */
350351
SKB_DROP_REASON_NEIGH_DEAD,
352+
/** @SKB_DROP_REASON_NEIGH_HH_FILLFAIL: failed to fill the device hard header */
353+
SKB_DROP_REASON_NEIGH_HH_FILLFAIL,
351354
/** @SKB_DROP_REASON_TC_EGRESS: dropped in TC egress HOOK */
352355
SKB_DROP_REASON_TC_EGRESS,
353356
/** @SKB_DROP_REASON_SECURITY_HOOK: dropped due to security HOOK */

net/core/neighbour.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb)
15171517
return rc;
15181518
out_kfree_skb:
15191519
rc = -EINVAL;
1520-
kfree_skb(skb);
1520+
kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_HH_FILLFAIL);
15211521
goto out;
15221522
}
15231523
EXPORT_SYMBOL(neigh_resolve_output);
@@ -1541,7 +1541,7 @@ int neigh_connected_output(struct neighbour *neigh, struct sk_buff *skb)
15411541
err = dev_queue_xmit(skb);
15421542
else {
15431543
err = -EINVAL;
1544-
kfree_skb(skb);
1544+
kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_HH_FILLFAIL);
15451545
}
15461546
return err;
15471547
}

0 commit comments

Comments
 (0)