Skip to content

Commit 4b115c4

Browse files
NikAleksandrovsmb49
authored andcommitted
bonding: fix null pointer deref in bond_ipsec_offload_ok
BugLink: https://bugs.launchpad.net/bugs/2080594 [ Upstream commit 95c90e4ad89d493a7a14fa200082e466e2548f9d ] We must check if there is an active slave before dereferencing the pointer. Fixes: 18cb261 ("bonding: support hardware encryption offload to slaves") Signed-off-by: Nikolay Aleksandrov <[email protected]> Reviewed-by: Hangbin Liu <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: Paolo Abeni <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Koichiro Den <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent 80153b7 commit 4b115c4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,8 @@ static bool bond_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
597597
bond = netdev_priv(bond_dev);
598598
rcu_read_lock();
599599
curr_active = rcu_dereference(bond->curr_active_slave);
600+
if (!curr_active)
601+
goto out;
600602
real_dev = curr_active->dev;
601603

602604
if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)

0 commit comments

Comments
 (0)