From: Emil Tantilov Date: Thu, 9 Jul 2015 19:28:59 +0000 (-0700) Subject: ixgbe: fix bounds checking in ixgbe_setup_tc for 82598 X-Git-Tag: v4.1.12-92~262^2~34 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=abe9b9e2e778c7e37f4effd7a345440523328cf2;p=users%2Fjedix%2Flinux-maple.git ixgbe: fix bounds checking in ixgbe_setup_tc for 82598 Orabug: 21918732 This patch resolves an issue where users were not able to dynamically set number of queues for 82598 via ethtool -L Reported-by: Tal Abudi Signed-off-by: Emil Tantilov Signed-off-by: Jeff Kirsher (cherry picked from commit 7e3f5c8881ba45eba1c74344b00558920008e6e6) Signed-off-by: Brian Maly --- diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 28a8506ebfa18..7e1d1d0e86e45 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -7842,9 +7842,10 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) bool pools; /* Hardware supports up to 8 traffic classes */ - if (tc > adapter->dcb_cfg.num_tcs.pg_tcs || - (hw->mac.type == ixgbe_mac_82598EB && - tc < MAX_TRAFFIC_CLASS)) + if (tc > adapter->dcb_cfg.num_tcs.pg_tcs) + return -EINVAL; + + if (hw->mac.type == ixgbe_mac_82598EB && tc && tc < MAX_TRAFFIC_CLASS) return -EINVAL; pools = (find_first_zero_bit(&adapter->fwd_bitmask, 32) > 1);