netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] ixgbevf: fix skb->pkt_type checks
@ 2014-02-28 23:46 Florian Fainelli
  2014-03-01  0:12 ` Brown, Aaron F
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2014-02-28 23:46 UTC (permalink / raw)
  To: netdev
  Cc: aaron.f.brown, alexander.h.duyck, jesse.brandeburg, e1000-devel,
	Florian Fainelli

skb->pkt_type is not a bitmask, but contains only value at a time from
the range defined in include/uapi/linux/if_packet.h.

Checking it like if it was a bitmask of values would also cause
PACKET_OTHERHOST, PACKET_LOOPBACK and PACKET_FASTROUTE to be matched by
this check since their lower 2 bits are also set, although that does not
fix a real bug, it is still potentially confusing.

This bogus check was introduced in commit 815cccbf ("ixgbe: add setlink,
getlink support to ixgbe and ixgbevf").

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
- properly resolve the rebase, fixes the build failure in v1

 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 57e0cd89b3dc..6ac5da219150 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -516,7 +516,8 @@ static int ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
 		/* Workaround hardware that can't do proper VEPA multicast
 		 * source pruning.
 		 */
-		if ((skb->pkt_type & (PACKET_BROADCAST | PACKET_MULTICAST)) &&
+		if ((skb->pkt_type == PACKET_BROADCAST ||
+		    skb->pkt_type == PACKET_MULTICAST) &&
 		    ether_addr_equal(rx_ring->netdev->dev_addr,
 				     eth_hdr(skb)->h_source)) {
 			dev_kfree_skb_irq(skb);
-- 
1.8.3.2

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

* Re: [PATCH net-next v2] ixgbevf: fix skb->pkt_type checks
  2014-02-28 23:46 [PATCH net-next v2] ixgbevf: fix skb->pkt_type checks Florian Fainelli
@ 2014-03-01  0:12 ` Brown, Aaron F
  0 siblings, 0 replies; 2+ messages in thread
From: Brown, Aaron F @ 2014-03-01  0:12 UTC (permalink / raw)
  To: f.fainelli@gmail.com
  Cc: Duyck, Alexander H, Brandeburg, Jesse, netdev@vger.kernel.org,
	e1000-devel@lists.sourceforge.net

On Fri, 2014-02-28 at 15:46 -0800, Florian Fainelli wrote:
> skb->pkt_type is not a bitmask, but contains only value at a time from
> the range defined in include/uapi/linux/if_packet.h.
> 
> Checking it like if it was a bitmask of values would also cause
> PACKET_OTHERHOST, PACKET_LOOPBACK and PACKET_FASTROUTE to be matched by
> this check since their lower 2 bits are also set, although that does not
> fix a real bug, it is still potentially confusing.
> 
> This bogus check was introduced in commit 815cccbf ("ixgbe: add setlink,
> getlink support to ixgbe and ixgbevf").
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Changes in v2:
> - properly resolve the rebase, fixes the build failure in v1

Thanks Florian, I have pulled this one into our internal queue (and yes
it compiles fine.)

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

end of thread, other threads:[~2014-03-01  0:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-28 23:46 [PATCH net-next v2] ixgbevf: fix skb->pkt_type checks Florian Fainelli
2014-03-01  0:12 ` Brown, Aaron F

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).