Skip to content

Commit

Permalink
bonding: fix bond_ipsec_offload_ok return type
Browse files Browse the repository at this point in the history
[ Upstream commit fc59b9a ]

Fix the return type which should be bool.

Fixes: 955b785 ("bonding: fix suspicious RCU usage in bond_ipsec_offload_ok()")
Signed-off-by: Nikolay Aleksandrov <[email protected]>
Reviewed-by: Hangbin Liu <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
NikAleksandrov authored and gregkh committed Aug 29, 2024
1 parent 467ee0d commit f2b3d38
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,34 +599,28 @@ static bool bond_ipsec_offload_ok(struct sk_buff *skb, struct xfrm_state *xs)
struct net_device *real_dev;
struct slave *curr_active;
struct bonding *bond;
int err;
bool ok = false;

bond = netdev_priv(bond_dev);
rcu_read_lock();
curr_active = rcu_dereference(bond->curr_active_slave);
real_dev = curr_active->dev;

if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP) {
err = false;
if (BOND_MODE(bond) != BOND_MODE_ACTIVEBACKUP)
goto out;
}

if (!xs->xso.real_dev) {
err = false;
if (!xs->xso.real_dev)
goto out;
}

if (!real_dev->xfrmdev_ops ||
!real_dev->xfrmdev_ops->xdo_dev_offload_ok ||
netif_is_bond_master(real_dev)) {
err = false;
netif_is_bond_master(real_dev))
goto out;
}

err = real_dev->xfrmdev_ops->xdo_dev_offload_ok(skb, xs);
ok = real_dev->xfrmdev_ops->xdo_dev_offload_ok(skb, xs);
out:
rcu_read_unlock();
return err;
return ok;
}

static const struct xfrmdev_ops bond_xfrmdev_ops = {
Expand Down

0 comments on commit f2b3d38

Please sign in to comment.