Skip to content

Commit

Permalink
bonding: fix null pointer deref in bond_ipsec_offload_ok
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
NikAleksandrov authored and Paolo Abeni committed Aug 20, 2024
1 parent fc59b9a commit 95c90e4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 95c90e4

Please sign in to comment.