mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
8021q: publish vlan_devices_arrays entries with acquire/release
Replace the smp_wmb()/smp_rmb() barrier pair with smp_store_release()/smp_load_acquire() on vg->vlan_devices_arrays[pidx][vidx]. vlan_group_prealloc_vid() publishes the array pointer via release; __vlan_group_get_device() acquires it before accessing the array, ensuring the allocated entries are visible. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
2e9ff7bb66
commit
d199b0d0bb
|
|
@ -70,10 +70,8 @@ static int vlan_group_prealloc_vid(struct vlan_group *vg,
|
|||
if (array == NULL)
|
||||
return -ENOBUFS;
|
||||
|
||||
/* paired with smp_rmb() in __vlan_group_get_device() */
|
||||
smp_wmb();
|
||||
|
||||
vg->vlan_devices_arrays[pidx][vidx] = array;
|
||||
/* paired with smp_load_acquire() in __vlan_group_get_device() */
|
||||
smp_store_release(&vg->vlan_devices_arrays[pidx][vidx], array);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,11 +56,9 @@ static inline struct net_device *__vlan_group_get_device(struct vlan_group *vg,
|
|||
{
|
||||
struct net_device __rcu **array;
|
||||
|
||||
array = vg->vlan_devices_arrays[pidx]
|
||||
[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
|
||||
|
||||
/* paired with smp_wmb() in vlan_group_prealloc_vid() */
|
||||
smp_rmb();
|
||||
/* Pairs with smp_store_release() in vlan_group_prealloc_vid() */
|
||||
array = smp_load_acquire(&vg->vlan_devices_arrays[pidx]
|
||||
[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]);
|
||||
|
||||
return array ? rcu_dereference_raw(array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]) : NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user