diff mbox series

[06/12] smartpqi: validate block layer host tag

Message ID 20230428153712.297638-7-don.brace@microchip.com
State New
Headers show
Series smartpqi updates | expand

Commit Message

Don Brace April 28, 2023, 3:37 p.m. UTC
From: Murthy Bhat <Murthy.Bhat@microchip.com>

Prevent OS crashes when a drive is hot removed during IO stress test.

IO request pointer can be invalid if block layer provides incorrect
multi-queue host tag. This can lead to invalid IO request
pointer dereference.

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
---
 drivers/scsi/smartpqi/smartpqi_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 7fe80bef1a15..f76b5a3e0fd1 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -708,7 +708,8 @@  static inline struct pqi_io_request *pqi_alloc_io_request(struct pqi_ctrl_info *
 		}
 	}
 
-	pqi_reinit_io_request(io_request);
+	if (io_request)
+		pqi_reinit_io_request(io_request);
 
 	return io_request;
 }