The ap->sff_pio_task_link gets cleared in a racy way in ata_sff_flush_pio_task(). This may lead to BUG_ON() check in the work, and screw up the whole system. Along with it, replace BUG_ON() with WARN_ON() and let the work quit gracefully. It's no end of the world, after all. Signed-off-by: Takashi Iwai <tiwai@xxxxxxx> --- drivers/ata/libata-sff.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index c5ea0fc635e5..28ef46ef656d 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -1271,9 +1271,8 @@ void ata_sff_flush_pio_task(struct ata_port *ap) */ spin_lock_irq(ap->lock); ap->hsm_task_state = HSM_ST_IDLE; - spin_unlock_irq(ap->lock); - ap->sff_pio_task_link = NULL; + spin_unlock_irq(ap->lock); if (ata_msg_ctl(ap)) ata_port_dbg(ap, "%s: EXIT\n", __func__); @@ -1283,14 +1282,17 @@ static void ata_sff_pio_task(struct work_struct *work) { struct ata_port *ap = container_of(work, struct ata_port, sff_pio_task.work); - struct ata_link *link = ap->sff_pio_task_link; + struct ata_link *link; struct ata_queued_cmd *qc; u8 status; int poll_next; spin_lock_irq(ap->lock); - BUG_ON(ap->sff_pio_task_link == NULL); + link = ap->sff_pio_task_link; + if (WARN_ON(!link)) + goto out_unlock; + /* qc can be NULL if timeout occurred */ qc = ata_qc_from_tag(ap, link->active_tag); if (!qc) { -- 2.19.1