Skip to content

Commit 911e572

Browse files
Guilherme G. Piccolimartinkpetersen
authored andcommitted
scsi: aacraid: fix PCI error recovery path
During a PCI error recovery, if aac_check_health() is not aware that a PCI error happened and we have an offline PCI channel, it might trigger some errors (like NULL pointer dereference) and inhibit the error recovery process to complete. This patch makes the health check procedure aware of PCI channel issues, and in case of error recovery process, the function aac_adapter_check_health() returns -1 and let the recovery process to complete successfully. This patch was tested on upstream kernel v4.11-rc5 in PowerPC ppc64le architecture with adapter 9005:028d (VID:DID) - the error recovery procedure was able to recover fine. Fixes: 5c63f7f ("aacraid: Added EEH support") Cc: stable@vger.kernel.org # v4.6+ Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Reviewed-by: Dave Carroll <david.carroll@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 7c85615 commit 911e572

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

drivers/scsi/aacraid/aacraid.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,9 +1690,6 @@ struct aac_dev
16901690
#define aac_adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4) \
16911691
(dev)->a_ops.adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4)
16921692

1693-
#define aac_adapter_check_health(dev) \
1694-
(dev)->a_ops.adapter_check_health(dev)
1695-
16961693
#define aac_adapter_restart(dev, bled, reset_type) \
16971694
((dev)->a_ops.adapter_restart(dev, bled, reset_type))
16981695

@@ -2615,6 +2612,14 @@ static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
26152612
return capacity;
26162613
}
26172614

2615+
static inline int aac_adapter_check_health(struct aac_dev *dev)
2616+
{
2617+
if (unlikely(pci_channel_offline(dev->pdev)))
2618+
return -1;
2619+
2620+
return (dev)->a_ops.adapter_check_health(dev);
2621+
}
2622+
26182623
/* SCp.phase values */
26192624
#define AAC_OWNER_MIDLEVEL 0x101
26202625
#define AAC_OWNER_LOWLEVEL 0x102

drivers/scsi/aacraid/commsup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,8 @@ int aac_check_health(struct aac_dev * aac)
18731873
spin_unlock_irqrestore(&aac->fib_lock, flagv);
18741874

18751875
if (BlinkLED < 0) {
1876-
printk(KERN_ERR "%s: Host adapter dead %d\n", aac->name, BlinkLED);
1876+
printk(KERN_ERR "%s: Host adapter is dead (or got a PCI error) %d\n",
1877+
aac->name, BlinkLED);
18771878
goto out;
18781879
}
18791880

0 commit comments

Comments
 (0)