summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ses.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2017-08-15 10:21:41 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2017-08-25 04:28:58 +0200
commitacf8ab9a85bfd6ead185a59c4cfe26b25d5a082f (patch)
treebc20b7ff2f08e4d35b54c1c4d8203dc4d63e1630 /drivers/scsi/ses.c
parentscsi: hpsa: Remove 'hpsa_allow_any' module option (diff)
downloadlinux-acf8ab9a85bfd6ead185a59c4cfe26b25d5a082f.tar.xz
linux-acf8ab9a85bfd6ead185a59c4cfe26b25d5a082f.zip
scsi: ses: check return code from ses_recv_diag()
We should be checking the return code from ses_recv_diag() to avoid accessing invalid data. Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/ses.c')
-rw-r--r--drivers/scsi/ses.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index f1cdf32d7514..2a651b2063a2 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -179,7 +179,8 @@ static unsigned char *ses_get_page2_descriptor(struct enclosure_device *edev,
unsigned char *type_ptr = ses_dev->page1_types;
unsigned char *desc_ptr = ses_dev->page2 + 8;
- ses_recv_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len);
+ if (ses_recv_diag(sdev, 2, ses_dev->page2, ses_dev->page2_len) < 0)
+ return NULL;
for (i = 0; i < ses_dev->page1_num_types; i++, type_ptr += 4) {
for (j = 0; j < type_ptr[1]; j++) {