[PATCH] ide-atapi: Check for blk_mq_alloc_request() errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If blk_mq_alloc_request() fails then it leads to an error pointer
dereference.

Fixes: 600335205b8d ("ide: convert to blk-mq")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
 drivers/ide/ide-atapi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index da58020a144e..6eea0a661240 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -200,6 +200,8 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)
 	if (!sense_rq) {
 		sense_rq = blk_mq_alloc_request(drive->queue, REQ_OP_DRV_IN,
 					BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT);
+		if (IS_ERR(sense_rq))
+			return;
 		drive->sense_rq = sense_rq;
 	}
 	req = scsi_req(sense_rq);
-- 
2.11.0




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux