aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan_core.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 1414c931bd3f..4d39d802be2c 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -326,14 +326,16 @@ int vlan_vids_add_by_dev(struct net_device *dev,
326 const struct net_device *by_dev) 326 const struct net_device *by_dev)
327{ 327{
328 struct vlan_vid_info *vid_info; 328 struct vlan_vid_info *vid_info;
329 struct vlan_info *vlan_info;
329 int err; 330 int err;
330 331
331 ASSERT_RTNL(); 332 ASSERT_RTNL();
332 333
333 if (!by_dev->vlan_info) 334 vlan_info = rtnl_dereference(by_dev->vlan_info);
335 if (!vlan_info)
334 return 0; 336 return 0;
335 337
336 list_for_each_entry(vid_info, &by_dev->vlan_info->vid_list, list) { 338 list_for_each_entry(vid_info, &vlan_info->vid_list, list) {
337 err = vlan_vid_add(dev, vid_info->vid); 339 err = vlan_vid_add(dev, vid_info->vid);
338 if (err) 340 if (err)
339 goto unwind; 341 goto unwind;
@@ -342,7 +344,7 @@ int vlan_vids_add_by_dev(struct net_device *dev,
342 344
343unwind: 345unwind:
344 list_for_each_entry_continue_reverse(vid_info, 346 list_for_each_entry_continue_reverse(vid_info,
345 &by_dev->vlan_info->vid_list, 347 &vlan_info->vid_list,
346 list) { 348 list) {
347 vlan_vid_del(dev, vid_info->vid); 349 vlan_vid_del(dev, vid_info->vid);
348 } 350 }
@@ -355,13 +357,15 @@ void vlan_vids_del_by_dev(struct net_device *dev,
355 const struct net_device *by_dev) 357 const struct net_device *by_dev)
356{ 358{
357 struct vlan_vid_info *vid_info; 359 struct vlan_vid_info *vid_info;
360 struct vlan_info *vlan_info;
358 361
359 ASSERT_RTNL(); 362 ASSERT_RTNL();
360 363
361 if (!by_dev->vlan_info) 364 vlan_info = rtnl_dereference(by_dev->vlan_info);
365 if (!vlan_info)
362 return; 366 return;
363 367
364 list_for_each_entry(vid_info, &by_dev->vlan_info->vid_list, list) 368 list_for_each_entry(vid_info, &vlan_info->vid_list, list)
365 vlan_vid_del(dev, vid_info->vid); 369 vlan_vid_del(dev, vid_info->vid);
366} 370}
367EXPORT_SYMBOL(vlan_vids_del_by_dev); 371EXPORT_SYMBOL(vlan_vids_del_by_dev);