netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net 1/2] i40e: fix null dereference
@ 2013-12-14 11:26 Jeff Kirsher
  2013-12-14 11:26 ` [net 2/2] igb: Fix for issue where values could be too high for udelay function Jeff Kirsher
  2013-12-15  4:00 ` [net 1/2] i40e: fix null dereference David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Jeff Kirsher @ 2013-12-14 11:26 UTC (permalink / raw)
  To: davem; +Cc: Jesse Brandeburg, netdev, gospo, sassmann, jeffrey.t.kirsher

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

If the vsi->tx_rings structure is NULL we don't want to panic.

Change-Id: Ic694f043701738c434e8ebe0caf0673f4410dc10
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index be15938..12b0932 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -354,6 +354,9 @@ static struct rtnl_link_stats64 *i40e_get_netdev_stats_struct(
 	struct rtnl_link_stats64 *vsi_stats = i40e_get_vsi_stats_struct(vsi);
 	int i;
 
+	if (!vsi->tx_rings)
+		return stats;
+
 	rcu_read_lock();
 	for (i = 0; i < vsi->num_queue_pairs; i++) {
 		struct i40e_ring *tx_ring, *rx_ring;
-- 
1.8.3.1

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

* [net 2/2] igb: Fix for issue where values could be too high for udelay function.
  2013-12-14 11:26 [net 1/2] i40e: fix null dereference Jeff Kirsher
@ 2013-12-14 11:26 ` Jeff Kirsher
  2013-12-15  4:00   ` David Miller
  2013-12-15 19:52   ` Sergei Shtylyov
  2013-12-15  4:00 ` [net 1/2] i40e: fix null dereference David Miller
  1 sibling, 2 replies; 5+ messages in thread
From: Jeff Kirsher @ 2013-12-14 11:26 UTC (permalink / raw)
  To: davem
  Cc: Carolyn Wyborny, netdev, gospo, sassmann, stable, sunil.k.pandey,
	kevin.b.smith, jeffrey.t.kirsher

From: Carolyn Wyborny <carolyn.wyborny@intel.com>

This patch changes the igb_phy_has_link function to check the value of the
parameter before deciding to use udelay or mdelay in order to be sure that
the value is not too high for udelay function.

CC: stable kernel <stable@vger.kernel.org> # 3.9+
Signed-off-by: Sunil K Pandey <sunil.k.pandey@intel.com>
Signed-off-by: Kevin B Smith <kevin.b.smith@intel.com>
Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/e1000_phy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
index c4c4fe3..ad2b74d 100644
--- a/drivers/net/ethernet/intel/igb/e1000_phy.c
+++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
@@ -1728,7 +1728,10 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations,
 			 * ownership of the resources, wait and try again to
 			 * see if they have relinquished the resources yet.
 			 */
-			udelay(usec_interval);
+			if (usec_interval >= 1000)
+				mdelay(usec_interval/1000);
+			else
+				udelay(usec_interval);
 		}
 		ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
 		if (ret_val)
-- 
1.8.3.1

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

* Re: [net 1/2] i40e: fix null dereference
  2013-12-14 11:26 [net 1/2] i40e: fix null dereference Jeff Kirsher
  2013-12-14 11:26 ` [net 2/2] igb: Fix for issue where values could be too high for udelay function Jeff Kirsher
@ 2013-12-15  4:00 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2013-12-15  4:00 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: jesse.brandeburg, netdev, gospo, sassmann

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sat, 14 Dec 2013 03:26:45 -0800

> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
> 
> If the vsi->tx_rings structure is NULL we don't want to panic.
> 
> Change-Id: Ic694f043701738c434e8ebe0caf0673f4410dc10
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

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

* Re: [net 2/2] igb: Fix for issue where values could be too high for udelay function.
  2013-12-14 11:26 ` [net 2/2] igb: Fix for issue where values could be too high for udelay function Jeff Kirsher
@ 2013-12-15  4:00   ` David Miller
  2013-12-15 19:52   ` Sergei Shtylyov
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2013-12-15  4:00 UTC (permalink / raw)
  To: jeffrey.t.kirsher
  Cc: carolyn.wyborny, netdev, gospo, sassmann, stable, sunil.k.pandey,
	kevin.b.smith

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Sat, 14 Dec 2013 03:26:46 -0800

> From: Carolyn Wyborny <carolyn.wyborny@intel.com>
> 
> This patch changes the igb_phy_has_link function to check the value of the
> parameter before deciding to use udelay or mdelay in order to be sure that
> the value is not too high for udelay function.
> 
> CC: stable kernel <stable@vger.kernel.org> # 3.9+
> Signed-off-by: Sunil K Pandey <sunil.k.pandey@intel.com>
> Signed-off-by: Kevin B Smith <kevin.b.smith@intel.com>
> Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
> Tested-by: Aaron Brown <aaron.f.brown@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

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

* Re: [net 2/2] igb: Fix for issue where values could be too high for udelay function.
  2013-12-14 11:26 ` [net 2/2] igb: Fix for issue where values could be too high for udelay function Jeff Kirsher
  2013-12-15  4:00   ` David Miller
@ 2013-12-15 19:52   ` Sergei Shtylyov
  1 sibling, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2013-12-15 19:52 UTC (permalink / raw)
  To: davem, Carolyn Wyborny
  Cc: Jeff Kirsher, netdev, gospo, sassmann, stable, sunil.k.pandey,
	kevin.b.smith

Hello.

On 12/14/2013 02:26 PM, Jeff Kirsher wrote:

> From: Carolyn Wyborny <carolyn.wyborny@intel.com>

> This patch changes the igb_phy_has_link function to check the value of the
> parameter before deciding to use udelay or mdelay in order to be sure that
> the value is not too high for udelay function.

> CC: stable kernel <stable@vger.kernel.org> # 3.9+
> Signed-off-by: Sunil K Pandey <sunil.k.pandey@intel.com>
> Signed-off-by: Kevin B Smith <kevin.b.smith@intel.com>
> Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
> Tested-by: Aaron Brown <aaron.f.brown@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>   drivers/net/ethernet/intel/igb/e1000_phy.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)

> diff --git a/drivers/net/ethernet/intel/igb/e1000_phy.c b/drivers/net/ethernet/intel/igb/e1000_phy.c
> index c4c4fe3..ad2b74d 100644
> --- a/drivers/net/ethernet/intel/igb/e1000_phy.c
> +++ b/drivers/net/ethernet/intel/igb/e1000_phy.c
> @@ -1728,7 +1728,10 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations,
>   			 * ownership of the resources, wait and try again to
>   			 * see if they have relinquished the resources yet.
>   			 */
> -			udelay(usec_interval);
> +			if (usec_interval >= 1000)
> +				mdelay(usec_interval/1000);

    There should be spaces around / at least for consistency with the previous 
line. Also, are you sure it shouldn't be mdelay(DIV_ROUND_UP(usec_interval, 
1000))?

WBR, Sergei

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

end of thread, other threads:[~2013-12-15 19:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-14 11:26 [net 1/2] i40e: fix null dereference Jeff Kirsher
2013-12-14 11:26 ` [net 2/2] igb: Fix for issue where values could be too high for udelay function Jeff Kirsher
2013-12-15  4:00   ` David Miller
2013-12-15 19:52   ` Sergei Shtylyov
2013-12-15  4:00 ` [net 1/2] i40e: fix null dereference David Miller

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