netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sky2: detect and prevent kernel panic from a possible faulty hardware
@ 2013-07-27 20:35 Samuel Williams
  2013-07-30 23:19 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Samuel Williams @ 2013-07-27 20:35 UTC (permalink / raw)
  To: mlindner; +Cc: netdev, linux-kernel, Samuel Williams

A possible faulty hardware might interrupt with a status of 0xffffffff which
may kernel panic if sky2 driver tries to handle it. Detecting this problem
may avoid kernel panic.

Signed-off-by: Samuel Williams <sam8641@gmail.com>
---
 drivers/net/ethernet/marvell/sky2.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index e09a8c6..43fe2f3 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -3049,8 +3049,17 @@ static int sky2_poll(struct napi_struct *napi, int work_limit)
 	int work_done = 0;
 	u16 idx;
 
-	if (unlikely(status & Y2_IS_ERROR))
+	if (unlikely(status & Y2_IS_ERROR)) {
+		if (status == 0xFFFFFFFF) {
+			dev_err(&hw->pdev->dev,
+				"fatal hardware inturrupt error\n");
+			napi_complete(napi);
+			napi_disable(&hw->napi);
+			return 0;
+		}
 		sky2_err_intr(hw, status);
+	}
+
 
 	if (status & Y2_IS_IRQ_PHY1)
 		sky2_phy_intr(hw, 0);
-- 
1.7.10.4

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

* Re: [PATCH] sky2: detect and prevent kernel panic from a possible faulty hardware
  2013-07-27 20:35 [PATCH] sky2: detect and prevent kernel panic from a possible faulty hardware Samuel Williams
@ 2013-07-30 23:19 ` David Miller
  2013-07-30 23:32   ` Stephen Hemminger
  2013-07-31  8:18   ` Oliver Neukum
  0 siblings, 2 replies; 4+ messages in thread
From: David Miller @ 2013-07-30 23:19 UTC (permalink / raw)
  To: sam8641; +Cc: mlindner, netdev, linux-kernel

From: Samuel Williams <sam8641@gmail.com>
Date: Sat, 27 Jul 2013 15:35:54 -0500

> A possible faulty hardware might interrupt with a status of 0xffffffff which
> may kernel panic if sky2 driver tries to handle it. Detecting this problem
> may avoid kernel panic.
> 
> Signed-off-by: Samuel Williams <sam8641@gmail.com>

Sure, but then the device is basically just going to stop.

I think this change needs to be more comprehensive, for example it
needs to fully reset the device and try to get it operational again.

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

* Re: [PATCH] sky2: detect and prevent kernel panic from a possible faulty hardware
  2013-07-30 23:19 ` David Miller
@ 2013-07-30 23:32   ` Stephen Hemminger
  2013-07-31  8:18   ` Oliver Neukum
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2013-07-30 23:32 UTC (permalink / raw)
  To: David Miller; +Cc: sam8641, mlindner, netdev, linux-kernel

On Tue, 30 Jul 2013 16:19:06 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Samuel Williams <sam8641@gmail.com>
> Date: Sat, 27 Jul 2013 15:35:54 -0500
> 
> > A possible faulty hardware might interrupt with a status of 0xffffffff which
> > may kernel panic if sky2 driver tries to handle it. Detecting this problem
> > may avoid kernel panic.
> > 
> > Signed-off-by: Samuel Williams <sam8641@gmail.com>
> 
> Sure, but then the device is basically just going to stop.
> 
> I think this change needs to be more comprehensive, for example it
> needs to fully reset the device and try to get it operational again.

Not only that it is going to assert IRQ until the device is hard
reset. Plus it is not clear that cleaning up after sick hardware
is possible at all.

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

* Re: [PATCH] sky2: detect and prevent kernel panic from a possible faulty hardware
  2013-07-30 23:19 ` David Miller
  2013-07-30 23:32   ` Stephen Hemminger
@ 2013-07-31  8:18   ` Oliver Neukum
  1 sibling, 0 replies; 4+ messages in thread
From: Oliver Neukum @ 2013-07-31  8:18 UTC (permalink / raw)
  To: David Miller; +Cc: sam8641, mlindner, netdev, linux-kernel

On Tue, 2013-07-30 at 16:19 -0700, David Miller wrote:
> From: Samuel Williams <sam8641@gmail.com>
> Date: Sat, 27 Jul 2013 15:35:54 -0500
> 
> > A possible faulty hardware might interrupt with a status of 0xffffffff which
> > may kernel panic if sky2 driver tries to handle it. Detecting this problem
> > may avoid kernel panic.
> > 
> > Signed-off-by: Samuel Williams <sam8641@gmail.com>
> 
> Sure, but then the device is basically just going to stop.
> 
> I think this change needs to be more comprehensive, for example it
> needs to fully reset the device and try to get it operational again.

But sky2 is used in some hotremovable cards. You can hit the window
for this race. It is unlikely but still this simple check fixes a bug.

	Regards
		Oliver

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

end of thread, other threads:[~2013-07-31  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-27 20:35 [PATCH] sky2: detect and prevent kernel panic from a possible faulty hardware Samuel Williams
2013-07-30 23:19 ` David Miller
2013-07-30 23:32   ` Stephen Hemminger
2013-07-31  8:18   ` Oliver Neukum

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