1 From 8305f72f952cff21ce8109dc1ea4b321c8efc5af Mon Sep 17 00:00:00 2001
2 From: Kai-Heng Feng <kai.heng.feng@canonical.com>
3 Date: Wed, 27 Mar 2019 17:02:54 +0800
4 Subject: libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set
6 From: Kai-Heng Feng <kai.heng.feng@canonical.com>
8 commit 8305f72f952cff21ce8109dc1ea4b321c8efc5af upstream.
10 During system resume from suspend, this can be observed on ASM1062 PMP
13 ata10.01: SATA link down (SStatus 0 SControl 330)
14 ata10.02: hard resetting link
15 ata10.02: SATA link down (SStatus 0 SControl 330)
16 ata10.00: configured for UDMA/133
17 Kernel panic - not syncing: stack-protector: Kernel
18 in: sata_pmp_eh_recover+0xa2b/0xa40
20 CPU: 2 PID: 230 Comm: scsi_eh_9 Tainted: P OE
22 Hardware name: System manufacturer System Product
27 ? sata_pmp_eh_recover+0xa2b/0xa40
28 __stack_chk_fail+0x19/0x20
29 sata_pmp_eh_recover+0xa2b/0xa40
30 ? ahci_do_softreset+0x260/0x260 [libahci]
31 ? ahci_do_hardreset+0x140/0x140 [libahci]
32 ? ata_phys_link_offline+0x60/0x60
33 ? ahci_stop_engine+0xc0/0xc0 [libahci]
34 sata_pmp_error_handler+0x22/0x30
35 ahci_error_handler+0x45/0x80 [libahci]
36 ata_scsi_port_error_handler+0x29b/0x770
37 ? ata_scsi_cmd_error_handler+0x101/0x140
38 ata_scsi_error+0x95/0xd0
39 ? scsi_try_target_reset+0x90/0x90
40 scsi_error_handler+0xd0/0x5b0
42 ? scsi_eh_get_sense+0x200/0x200
43 ? kthread_create_worker_on_cpu+0x70/0x70
44 ret_from_fork+0x22/0x40
45 Kernel Offset: 0xcc00000 from 0xffffffff81000000
46 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
48 Since sata_pmp_eh_recover_pmp() doens't set rc when ATA_DFLAG_DETACH is
49 set, sata_pmp_eh_recover() continues to run. During retry it triggers
52 Set correct rc in sata_pmp_eh_recover_pmp() to let sata_pmp_eh_recover()
53 jump to pmp_fail directly.
55 BugLink: https://bugs.launchpad.net/bugs/1821434
56 Cc: stable@vger.kernel.org
57 Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
58 Signed-off-by: Jens Axboe <axboe@kernel.dk>
59 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
62 drivers/ata/libata-pmp.c | 1 +
63 1 file changed, 1 insertion(+)
65 --- a/drivers/ata/libata-pmp.c
66 +++ b/drivers/ata/libata-pmp.c
67 @@ -764,6 +764,7 @@ static int sata_pmp_eh_recover_pmp(struc
69 if (dev->flags & ATA_DFLAG_DETACH) {