diff options
author | Roland Dreier <roland@purestorage.com> | 2012-08-10 19:52:13 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-08-10 19:52:13 -0400 |
commit | d549f55f2e132e3d1f1288ce4231f45f12988bbf (patch) | |
tree | 2b61704aafe54aab65f043366352f5391d236a07 /drivers/infiniband/hw/ocrdma/ocrdma_main.c | |
parent | 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff) |
RDMA/ocrdma: Don't call vlan_dev_real_dev() for non-VLAN netdevs
If CONFIG_VLAN_8021Q is not set, then vlan_dev_real_dev() just goes BUG(),
so we shouldn't call it unless we're actually dealing with a VLAN netdev.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/ocrdma/ocrdma_main.c')
-rw-r--r-- | drivers/infiniband/hw/ocrdma/ocrdma_main.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index 5a044526e4f4..c4e0131f1b57 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c | |||
@@ -161,7 +161,7 @@ static void ocrdma_add_default_sgid(struct ocrdma_dev *dev) | |||
161 | ocrdma_get_guid(dev, &sgid->raw[8]); | 161 | ocrdma_get_guid(dev, &sgid->raw[8]); |
162 | } | 162 | } |
163 | 163 | ||
164 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 164 | #if IS_ENABLED(CONFIG_VLAN_8021Q) |
165 | static void ocrdma_add_vlan_sgids(struct ocrdma_dev *dev) | 165 | static void ocrdma_add_vlan_sgids(struct ocrdma_dev *dev) |
166 | { | 166 | { |
167 | struct net_device *netdev, *tmp; | 167 | struct net_device *netdev, *tmp; |
@@ -202,14 +202,13 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev) | |||
202 | return 0; | 202 | return 0; |
203 | } | 203 | } |
204 | 204 | ||
205 | #if IS_ENABLED(CONFIG_IPV6) || IS_ENABLED(CONFIG_VLAN_8021Q) | 205 | #if IS_ENABLED(CONFIG_IPV6) |
206 | 206 | ||
207 | static int ocrdma_inet6addr_event(struct notifier_block *notifier, | 207 | static int ocrdma_inet6addr_event(struct notifier_block *notifier, |
208 | unsigned long event, void *ptr) | 208 | unsigned long event, void *ptr) |
209 | { | 209 | { |
210 | struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr; | 210 | struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr; |
211 | struct net_device *event_netdev = ifa->idev->dev; | 211 | struct net_device *netdev = ifa->idev->dev; |
212 | struct net_device *netdev = NULL; | ||
213 | struct ib_event gid_event; | 212 | struct ib_event gid_event; |
214 | struct ocrdma_dev *dev; | 213 | struct ocrdma_dev *dev; |
215 | bool found = false; | 214 | bool found = false; |
@@ -217,11 +216,12 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier, | |||
217 | bool is_vlan = false; | 216 | bool is_vlan = false; |
218 | u16 vid = 0; | 217 | u16 vid = 0; |
219 | 218 | ||
220 | netdev = vlan_dev_real_dev(event_netdev); | 219 | is_vlan = netdev->priv_flags & IFF_802_1Q_VLAN; |
221 | if (netdev != event_netdev) { | 220 | if (is_vlan) { |
222 | is_vlan = true; | 221 | vid = vlan_dev_vlan_id(netdev); |
223 | vid = vlan_dev_vlan_id(event_netdev); | 222 | netdev = vlan_dev_real_dev(netdev); |
224 | } | 223 | } |
224 | |||
225 | rcu_read_lock(); | 225 | rcu_read_lock(); |
226 | list_for_each_entry_rcu(dev, &ocrdma_dev_list, entry) { | 226 | list_for_each_entry_rcu(dev, &ocrdma_dev_list, entry) { |
227 | if (dev->nic_info.netdev == netdev) { | 227 | if (dev->nic_info.netdev == netdev) { |