Commit 95c90e4a authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by Paolo Abeni

bonding: fix null pointer deref in bond_ipsec_offload_ok

We must check if there is an active slave before dereferencing the pointer.

Fixes: 18cb261a ("bonding: support hardware encryption offload to slaves")
Signed-off-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent fc59b9a5
...@@ -604,6 +604,8 @@ static bool bond_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs) ...@@ -604,6 +604,8 @@ static bool bond_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
bond = netdev_priv(bond_dev); bond = netdev_priv(bond_dev);
rcu_read_lock(); rcu_read_lock();
curr_active = rcu_dereference(bond->curr_active_slave); curr_active = rcu_dereference(bond->curr_active_slave);
if (!curr_active)
goto out;
real_dev = curr_active->dev; real_dev = curr_active->dev;
if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment