Commit 74f2d19c authored by Padmanabh Ratnakar's avatar Padmanabh Ratnakar Committed by David S. Miller

vlan: Invoke driver vlan hooks only if device is present

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: default avatarPadmanabh Ratnakar <padmanabh.ratnakar@avagotech.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 754107e3
...@@ -206,7 +206,10 @@ static int __vlan_vid_add(struct vlan_info *vlan_info, __be16 proto, u16 vid, ...@@ -206,7 +206,10 @@ static int __vlan_vid_add(struct vlan_info *vlan_info, __be16 proto, u16 vid,
return -ENOMEM; return -ENOMEM;
if (vlan_hw_filter_capable(dev, vid_info)) { 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) { if (err) {
kfree(vid_info); kfree(vid_info);
return err; return err;
...@@ -264,7 +267,10 @@ static void __vlan_vid_del(struct vlan_info *vlan_info, ...@@ -264,7 +267,10 @@ static void __vlan_vid_del(struct vlan_info *vlan_info,
int err; int err;
if (vlan_hw_filter_capable(dev, vid_info)) { 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) { if (err) {
pr_warn("failed to kill vid %04x/%d for device %s\n", pr_warn("failed to kill vid %04x/%d for device %s\n",
proto, vid, dev->name); proto, vid, dev->name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment