Skip to contentSkip to conversation

sky2: detect and prevent kernel panic from a possible faulty hardware

PATCH In review Samuel Williams 4 participants 4 messages Jul 27, 2013 – Jul 31, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sky2: detect and prevent kernel panic from a possible faulty hardware

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.

---
 drivers/net/ethernet/marvell/sky2.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/sky2.c +10 -1
index e09a8c6..43fe2f3 100644
@@ -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);
Signature · 1 line
1.7.10.4
maintainer
#1 lore raw

From: Samuel Williams <[email protected]>
Date: Sat, 27 Jul 2013 15:35:54 -0500

Quoted 5 lines

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.

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.

#2 lore raw
Quoted 7 lines · On Tue, 30 Jul 2013 16:19:06 -0700 (PDT) David Miller <[email protected]>…

From: Samuel Williams <[email protected]>
Date: Sat, 27 Jul 2013 15:35:54 -0500

Quoted 4 lines

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.

Quoted 6 lines
Quoted 1 line

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.

#3 lore raw
In reply to David Miller
Quoted 7 lines · David Miller

From: Samuel Williams <[email protected]>
Date: Sat, 27 Jul 2013 15:35:54 -0500

Quoted 4 lines

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.

Quoted 6 lines
Quoted 1 line

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