ip6mr: plug drop_reason to ip6mr_cache_report()
Subsystems (3)
PATCH 1/1 ip6mr: plug drop_reason to ip6mr_cache_report()
- Check mrt->mroute_sk earlier in the function.
- Use sock_queue_rcv_skb_reason() instead of sock_queue_rcv_skb().
- Use sk_skb_reason_drop() instead of kfree_skb().
Note that we return -ENOMEM if sock_queue_rcv_skb_reason() failed, as the precise error is not really needed for callers.
- Remove one net_warn_ratelimited().
--- net/ipv6/ip6mr.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
net/ipv6/ip6mr.c +10 -12
@@ -1063,10 +1063,14 @@ static void ip6mr_cache_resolve(struct net *net, struct mr_table *mrt,static int ip6mr_cache_report (const struct mr_table *mrt,struct sk_buff *pkt,mifi_t mifi,int assert) { +enum skb_drop_reason reason;struct sock *mroute6_sk;struct sk_buff *skb;struct mrt6msg *msg; -int ret; + + mroute6_sk =rcu_dereference (mrt->mroute_sk); +if (!mroute6_sk) +return -EINVAL ;#ifdef CONFIG_IPV6_PIMSM_V2 if (assert ==MRT6MSG_WHOLEPKT || assert ==MRT6MSG_WRMIFWHOLE )
@@ -1136,23 +1140,17 @@ static int ip6mr_cache_report(const struct mr_table *mrt, struct sk_buff *pkt, skb->ip_summed =CHECKSUM_UNNECESSARY ; } - mroute6_sk =rcu_dereference (mrt->mroute_sk); -if (!mroute6_sk) { -kfree_skb (skb); -return -EINVAL ; - } -mrt6msg_netlink_event (mrt, skb);/* Deliver to user space multicast routing algorithms */ - ret =sock_queue_rcv_skb (mroute6_sk, skb); + reason =sock_queue_rcv_skb_reason (mroute6_sk, skb); -if (ret <0 ) { -net_warn_ratelimited ("mroute6: pending queue full, dropping entries\n" ); -kfree_skb (skb); +if (reason) { +sk_skb_reason_drop (mroute6_sk, skb, reason); +return -ENOMEM ; } -return ret; +return 0 ; }/* Queue a packet for resolution. It gets locked cache entry! */
Signature · 1 line
2.54.0.545.g6539524ca2-goog
Quoted 10 lines · Eric Dumazet
- Check
mrt->mroute_skearlier in the function.- Use
sock_queue_rcv_skb_reason()instead ofsock_queue_rcv_skb().
- Usesk_skb_reason_drop()instead ofkfree_skb().
Note that we return-ENOMEMifsock_queue_rcv_skb_reason()failed, as the precise error is not really needed for callers.- Remove one
net_warn_ratelimited().Signed-off-by Eric Dumazet <[email protected]>
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Thu, 30 Apr 2026 07:40:04 +0000 you wrote:
- Check
mrt->mroute_skearlier in the function.- Use
sock_queue_rcv_skb_reason()instead ofsock_queue_rcv_skb().
- Usesk_skb_reason_drop()instead ofkfree_skb().
Note that we return-ENOMEMifsock_queue_rcv_skb_reason()failed, as the precise error is not really needed for callers.[...]
Here is the summary with links:
- [net-next] ip6mr: plug drop_reason to ip6mr_cache_report()
https://git.kernel.org/netdev/net-next/c/8d59a7a188c0
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html