summaryrefslogtreecommitdiff
path: root/drivers/ide/ide-park.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-01-30 18:41:40 +0300
committerJens Axboe <axboe@kernel.dk>2019-01-31 18:25:09 +0300
commit9a6d5488002fdca7134a0e59b0ae252f61042810 (patch)
treeda65822cbac6defce676db665ea2ffb4cb89903b /drivers/ide/ide-park.c
parent85bd6e61f34dffa8ec2dc75ff3c02ee7b2f1cbce (diff)
downloadlinux-9a6d5488002fdca7134a0e59b0ae252f61042810.tar.xz
ide: ensure atapi sense request aren't preempted
There's an issue with how sense requests are handled in IDE. If ide-cd encounters an error, it queues a sense request. With how IDE request handling is done, this is the next request we need to handle. But it's impossible to guarantee this, as another request could come in between the sense being queued, and ->queue_rq() being run and handling it. If that request ALSO fails, then we attempt to doubly queue the single sense request we have. Since we only support one active request at the time, defer request processing when a sense request is queued. Fixes: 600335205b8d "ide: convert to blk-mq" Reported-by: He Zhe <zhe.he@windriver.com> Tested-by: He Zhe <zhe.he@windriver.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/ide/ide-park.c')
-rw-r--r--drivers/ide/ide-park.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c
index 102aa3bc3e7f..8af7af6001eb 100644
--- a/drivers/ide/ide-park.c
+++ b/drivers/ide/ide-park.c
@@ -54,7 +54,9 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout)
scsi_req(rq)->cmd[0] = REQ_UNPARK_HEADS;
scsi_req(rq)->cmd_len = 1;
ide_req(rq)->type = ATA_PRIV_MISC;
+ spin_lock_irq(&hwif->lock);
ide_insert_request_head(drive, rq);
+ spin_unlock_irq(&hwif->lock);
out:
return;