Skip to content

Commit 95c90e4

Browse files
NikAleksandrovPaolo Abeni
authored and
Paolo Abeni
committed
bonding: fix null pointer deref in bond_ipsec_offload_ok
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]>
1 parent fc59b9a commit 95c90e4

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
@@ -604,6 +604,8 @@ static bool bond_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
604604
bond = netdev_priv(bond_dev);
605605
rcu_read_lock();
606606
curr_active = rcu_dereference(bond->curr_active_slave);
607+
if (!curr_active)
608+
goto out;
607609
real_dev = curr_active->dev;
608610

609611
if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)

0 commit comments

Comments
 (0)