netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/8021q: Check the correct vlan filter capability
@ 2016-02-24 16:39 Saeed Mahameed
  2016-02-24 16:48 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Saeed Mahameed @ 2016-02-24 16:39 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Gal Pressman, Or Gerlitz, Patrick McHardy, Saeed Mahameed

From: Gal Pressman <galp@mellanox.com>

Use dev->hw_features in vlan_hw_filter_capable instead of dev->features,
since dev->features can be turned on/off dynamically.

Netdev features can be changed dynamically to off after vlan_vid_add
was called, thus vlan_vid_del will skip ndo_vlan_rx_kill_vid and will
leave the device driver with un-freed resources.

Fixes: 8ad227ff89a7 ("net: vlan: add 802.1ad support")
Signed-off-by: Gal Pressman <galp@mellanox.com>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 net/8021q/vlan.c      |    4 ++--
 net/8021q/vlan_core.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index d2cd9de..f744d8c 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -365,7 +365,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
 	}
 
 	if ((event == NETDEV_UP) &&
-	    (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
+	    (dev->hw_features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
 		pr_info("adding VLAN 0 to HW filter on device %s\n",
 			dev->name);
 		vlan_vid_add(dev, htons(ETH_P_8021Q), 0);
@@ -417,7 +417,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
 		struct net_device *tmp;
 		LIST_HEAD(close_list);
 
-		if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
+		if (dev->hw_features & NETIF_F_HW_VLAN_CTAG_FILTER)
 			vlan_vid_del(dev, htons(ETH_P_8021Q), 0);
 
 		/* Put all VLANs for this dev in the down state too.  */
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index e2ed698..bab95bd 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -162,10 +162,10 @@ static bool vlan_hw_filter_capable(const struct net_device *dev,
 				     const struct vlan_vid_info *vid_info)
 {
 	if (vid_info->proto == htons(ETH_P_8021Q) &&
-	    dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
+	    dev->hw_features & NETIF_F_HW_VLAN_CTAG_FILTER)
 		return true;
 	if (vid_info->proto == htons(ETH_P_8021AD) &&
-	    dev->features & NETIF_F_HW_VLAN_STAG_FILTER)
+	    dev->hw_features & NETIF_F_HW_VLAN_STAG_FILTER)
 		return true;
 	return false;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-25  3:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-24 16:39 [PATCH net] net/8021q: Check the correct vlan filter capability Saeed Mahameed
2016-02-24 16:48 ` David Miller
2016-02-24 20:27   ` Saeed Mahameed
2016-02-24 20:35     ` Saeed Mahameed
2016-02-24 21:49       ` David Miller
2016-02-24 21:48     ` David Miller
2016-02-25  3:58       ` John Fastabend

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).