]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
netlink: Fix rmem check in netlink_broadcast_deliver().
authorKuniyuki Iwashima <kuniyu@google.com>
Fri, 11 Jul 2025 05:32:07 +0000 (05:32 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 11 Jul 2025 14:31:41 +0000 (07:31 -0700)
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.")
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250711053208.2965945-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/netlink/af_netlink.c

index 79fbaf7333ce2b64b28516f13a5462151217748e..2d107a8a75d993738ffee837ca774b60a06da12e 100644 (file)
@@ -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);