File tree Expand file tree Collapse file tree 1 file changed +21
-10
lines changed Expand file tree Collapse file tree 1 file changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -3702,24 +3702,35 @@ static int bond_neigh_init(struct neighbour *n)
3702
3702
const struct net_device_ops * slave_ops ;
3703
3703
struct neigh_parms parms ;
3704
3704
struct slave * slave ;
3705
- int ret ;
3705
+ int ret = 0 ;
3706
3706
3707
- slave = bond_first_slave (bond );
3707
+ rcu_read_lock ();
3708
+ slave = bond_first_slave_rcu (bond );
3708
3709
if (!slave )
3709
- return 0 ;
3710
+ goto out ;
3710
3711
slave_ops = slave -> dev -> netdev_ops ;
3711
3712
if (!slave_ops -> ndo_neigh_setup )
3712
- return 0 ;
3713
+ goto out ;
3713
3714
3714
- parms .neigh_setup = NULL ;
3715
+ /* TODO: find another way [1] to implement this.
3716
+ * Passing a zeroed structure is fragile,
3717
+ * but at least we do not pass garbage.
3718
+ *
3719
+ * [1] One way would be that ndo_neigh_setup() never touch
3720
+ * struct neigh_parms, but propagate the new neigh_setup()
3721
+ * back to ___neigh_create() / neigh_parms_alloc()
3722
+ */
3723
+ memset (& parms , 0 , sizeof (parms ));
3715
3724
ret = slave_ops -> ndo_neigh_setup (slave -> dev , & parms );
3716
- if (ret )
3717
- return ret ;
3718
3725
3719
- if (! parms . neigh_setup )
3720
- return 0 ;
3726
+ if (ret )
3727
+ goto out ;
3721
3728
3722
- return parms .neigh_setup (n );
3729
+ if (parms .neigh_setup )
3730
+ ret = parms .neigh_setup (n );
3731
+ out :
3732
+ rcu_read_unlock ();
3733
+ return ret ;
3723
3734
}
3724
3735
3725
3736
/* The bonding ndo_neigh_setup is called at init time beofre any
You can’t perform that action at this time.
0 commit comments