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 <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>
  • Loading branch information
NikAleksandrov authored and Mr-Bossman committed Sep 16, 2024
1 parent 1f3a26f commit 5ae6a9b
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 5ae6a9b

Please sign in to comment.