Skip to contentSkip to conversation

netlink: Fix rmem check in netlink_broadcast_deliver().

PATCH Applied Kuniyuki Iwashima 2 participants 2 messages Jul 11, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netlink: Fix rmem check in netlink_broadcast_deliver().

We need to allow queuing at least one skb even when skb is larger than sk->sk_rcvbuf.

The cited commit made a mistake while converting a condition in netlink_broadcast_deliver().

Let's correct the rmem check for the allow-one-skb rule.

Fixes ae8f160e7eb24 ("netlink: Fix wraparounds of sk->sk_rmem_alloc.")
---
 net/netlink/af_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netlink/af_netlink.c +1 -1
index 79fbaf7333ce2..2d107a8a75d99 100644
@@ -1395,7 +1395,7 @@ static int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
 	rmem = atomic_add_return(skb->truesize, &sk->sk_rmem_alloc);
 	rcvbuf = READ_ONCE(sk->sk_rcvbuf);
 
-	if ((rmem != skb->truesize || rmem <= rcvbuf) &&
+	if ((rmem == skb->truesize || rmem <= rcvbuf) &&
 	    !test_bit(NETLINK_S_CONGESTED, &nlk->state)) {
 		netlink_skb_set_owner_r(skb, sk);
 		__netlink_sendskb(sk, skb);
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Fri, 11 Jul 2025 05:32:07 +0000 you wrote:

We need to allow queuing at least one skb even when skb is larger than sk->sk_rcvbuf.

The cited commit made a mistake while converting a condition in netlink_broadcast_deliver().

Let's correct the rmem check for the allow-one-skb rule.

[...]

Here is the summary with links:
- [v1,net] netlink: Fix rmem check in netlink_broadcast_deliver().

    https://git.kernel.org/netdev/net/c/a3c4a125ec72

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html