]> www.infradead.org Git - users/hch/configfs.git/commitdiff
bonding: fix null pointer deref in bond_ipsec_offload_ok
authorNikolay Aleksandrov <razor@blackwall.org>
Fri, 16 Aug 2024 11:48:11 +0000 (14:48 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 20 Aug 2024 13:29:28 +0000 (15:29 +0200)
We must check if there is an active slave before dereferencing the pointer.

Fixes: 18cb261afd7b ("bonding: support hardware encryption offload to slaves")
Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/bonding/bond_main.c

index 85b5868deeeaf63a191cfb16d2deec0e0dad18f1..65ddb71eebcda21f1dd3a182fb0623e2062fd2eb 100644 (file)
@@ -604,6 +604,8 @@ static bool bond_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
        bond = netdev_priv(bond_dev);
        rcu_read_lock();
        curr_active = rcu_dereference(bond->curr_active_slave);
+       if (!curr_active)
+               goto out;
        real_dev = curr_active->dev;
 
        if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)