Subject: Re: [PATCH net V3 1/3] bonding: implement xdo_dev_state_free and call it after deletion

From: Jakub Kicinski <[email-masked]>
Date: Mon, 12 Aug 2024 17:48:34 -0700

On Mon, 5 Aug 2024 08:03:55 +0300 Tariq Toukan wrote:
> +static void bond_ipsec_free_sa(struct xfrm_state *xs)
> +{
> +	struct net_device *bond_dev = xs->xso.dev;
> +	struct net_device *real_dev;
> +	struct bonding *bond;
> +	struct slave *slave;
> +
> +	if (!bond_dev)
> +		return;

can xs->xso.dev be NULL during the dev_free_state callback?

> +	rcu_read_lock();
> +	bond = netdev_priv(bond_dev);
> +	slave = rcu_dereference(bond->curr_active_slave);
> +	real_dev = slave ? slave->dev : NULL;
> +	rcu_read_unlock();

What's holding onto real_dev once you drop the rcu lock here?