The scsi_get_command() function returns NULL if
it fails to allocate the scsi_cmnd structure.
If this happens, a NULL pointer will be dereferenced.

Signed-off-by: Maurizio Lombardi <[email protected]>
---
 drivers/scsi/scsi_error.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 78b004d..4021849 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2289,6 +2289,9 @@ scsi_reset_provider(struct scsi_device *dev, int flag)
                return FAILED;
 
        scmd = scsi_get_command(dev, GFP_KERNEL);
+       if (!scmd)
+               return FAILED;
+
        blk_rq_init(NULL, &req);
        scmd->request = &req;
 
-- 
Maurizio Lombardi

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to