• Kai-Heng Feng's avatar
    libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set · 8305f72f
    Kai-Heng Feng authored
    During system resume from suspend, this can be observed on ASM1062 PMP
    controller:
    
    ata10.01: SATA link down (SStatus 0 SControl 330)
    ata10.02: hard resetting link
    ata10.02: SATA link down (SStatus 0 SControl 330)
    ata10.00: configured for UDMA/133
    Kernel panic - not syncing: stack-protector: Kernel
     in: sata_pmp_eh_recover+0xa2b/0xa40
    
    CPU: 2 PID: 230 Comm: scsi_eh_9 Tainted: P OE
    #49-Ubuntu
    Hardware name: System manufacturer System Product
     1001 12/10/2017
    Call Trace:
    dump_stack+0x63/0x8b
    panic+0xe4/0x244
    ? sata_pmp_eh_recover+0xa2b/0xa40
    __stack_chk_fail+0x19/0x20
    sata_pmp_eh_recover+0xa2b/0xa40
    ? ahci_do_softreset+0x260/0x260 [libahci]
    ? ahci_do_hardreset+0x140/0x140 [libahci]
    ? ata_phys_link_offline+0x60/0x60
    ? ahci_stop_engine+0xc0/0xc0 [libahci]
    sata_pmp_error_handler+0x22/0x30
    ahci_error_handler+0x45/0x80 [libahci]
    ata_scsi_port_error_handler+0x29b/0x770
    ? ata_scsi_cmd_error_handler+0x101/0x140
    ata_scsi_error+0x95/0xd0
    ? scsi_try_target_reset+0x90/0x90
    scsi_error_handler+0xd0/0x5b0
    kthread+0x121/0x140
    ? scsi_eh_get_sense+0x200/0x200
    ? kthread_create_worker_on_cpu+0x70/0x70
    ret_from_fork+0x22/0x40
    Kernel Offset: 0xcc00000 from 0xffffffff81000000
    (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
    
    Since sata_pmp_eh_recover_pmp() doens't set rc when ATA_DFLAG_DETACH is
    set, sata_pmp_eh_recover() continues to run. During retry it triggers
    the stack protector.
    
    Set correct rc in sata_pmp_eh_recover_pmp() to let sata_pmp_eh_recover()
    jump to pmp_fail directly.
    
    BugLink: https://bugs.launchpad.net/bugs/1821434
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    8305f72f
libata-pmp.c 26 KB