Skip to content

Commit

Permalink
vlan: Invoke driver vlan hooks only if device is present
Browse files Browse the repository at this point in the history
NIC drivers mark device as detached during error recovery.
It expects no manangement hooks to be invoked in this state.
Invoke driver vlan hooks only if device is present.

Signed-off-by: Padmanabh Ratnakar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Padmanabh Ratnakar authored and davem330 committed Nov 3, 2015
1 parent 754107e commit 74f2d19
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/8021q/vlan_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@ static int __vlan_vid_add(struct vlan_info *vlan_info, __be16 proto, u16 vid,
return -ENOMEM;

if (vlan_hw_filter_capable(dev, vid_info)) {
err = ops->ndo_vlan_rx_add_vid(dev, proto, vid);
if (netif_device_present(dev))
err = ops->ndo_vlan_rx_add_vid(dev, proto, vid);
else
err = -ENODEV;
if (err) {
kfree(vid_info);
return err;
Expand Down Expand Up @@ -264,7 +267,10 @@ static void __vlan_vid_del(struct vlan_info *vlan_info,
int err;

if (vlan_hw_filter_capable(dev, vid_info)) {
err = ops->ndo_vlan_rx_kill_vid(dev, proto, vid);
if (netif_device_present(dev))
err = ops->ndo_vlan_rx_kill_vid(dev, proto, vid);
else
err = -ENODEV;
if (err) {
pr_warn("failed to kill vid %04x/%d for device %s\n",
proto, vid, dev->name);
Expand Down

0 comments on commit 74f2d19

Please sign in to comment.