aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-08-30 18:03:00 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-08-30 18:03:00 -0400
commitc02bf3e5a698073ed1927365a6a1e70e60baf4ae (patch)
treeafaafa03da027a0bffc67358c6529913f78e4d66
parent0761fc15e353aab18e60efacb2faad0b873d3fa8 (diff)
parent47c4ccd3086139d2085e0f1e59c0f26e8ce4ff46 (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Three minor fixes: a NULL deref in qedf, an off by one in sg and a fix to IPR to prevent an error on initialisation" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: qedf: Fix a potential NULL pointer dereference scsi: sg: off by one in sg_ioctl() scsi: ipr: Set no_report_opcodes for RAID arrays
-rw-r--r--drivers/scsi/ipr.c1
-rw-r--r--drivers/scsi/qedf/qedf_els.c14
-rw-r--r--drivers/scsi/sg.c2
3 files changed, 10 insertions, 7 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index da5bdbdcce52..f838bd73befa 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -4945,6 +4945,7 @@ static int ipr_slave_configure(struct scsi_device *sdev)
4945 } 4945 }
4946 if (ipr_is_vset_device(res)) { 4946 if (ipr_is_vset_device(res)) {
4947 sdev->scsi_level = SCSI_SPC_3; 4947 sdev->scsi_level = SCSI_SPC_3;
4948 sdev->no_report_opcodes = 1;
4948 blk_queue_rq_timeout(sdev->request_queue, 4949 blk_queue_rq_timeout(sdev->request_queue,
4949 IPR_VSET_RW_TIMEOUT); 4950 IPR_VSET_RW_TIMEOUT);
4950 blk_queue_max_hw_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS); 4951 blk_queue_max_hw_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS);
diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c
index eb07f1de8afa..59c18ca4cda9 100644
--- a/drivers/scsi/qedf/qedf_els.c
+++ b/drivers/scsi/qedf/qedf_els.c
@@ -489,7 +489,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
489 489
490 /* If a SRR times out, simply free resources */ 490 /* If a SRR times out, simply free resources */
491 if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO) 491 if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO)
492 goto out_free; 492 goto out_put;
493 493
494 /* Normalize response data into struct fc_frame */ 494 /* Normalize response data into struct fc_frame */
495 mp_req = &(srr_req->mp_req); 495 mp_req = &(srr_req->mp_req);
@@ -501,7 +501,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
501 if (!fp) { 501 if (!fp) {
502 QEDF_ERR(&(qedf->dbg_ctx), 502 QEDF_ERR(&(qedf->dbg_ctx),
503 "fc_frame_alloc failure.\n"); 503 "fc_frame_alloc failure.\n");
504 goto out_free; 504 goto out_put;
505 } 505 }
506 506
507 /* Copy frame header from firmware into fp */ 507 /* Copy frame header from firmware into fp */
@@ -526,9 +526,10 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
526 } 526 }
527 527
528 fc_frame_free(fp); 528 fc_frame_free(fp);
529out_free: 529out_put:
530 /* Put reference for original command since SRR completed */ 530 /* Put reference for original command since SRR completed */
531 kref_put(&orig_io_req->refcount, qedf_release_cmd); 531 kref_put(&orig_io_req->refcount, qedf_release_cmd);
532out_free:
532 kfree(cb_arg); 533 kfree(cb_arg);
533} 534}
534 535
@@ -780,7 +781,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
780 781
781 /* If a REC times out, free resources */ 782 /* If a REC times out, free resources */
782 if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO) 783 if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO)
783 goto out_free; 784 goto out_put;
784 785
785 /* Normalize response data into struct fc_frame */ 786 /* Normalize response data into struct fc_frame */
786 mp_req = &(rec_req->mp_req); 787 mp_req = &(rec_req->mp_req);
@@ -792,7 +793,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
792 if (!fp) { 793 if (!fp) {
793 QEDF_ERR(&(qedf->dbg_ctx), 794 QEDF_ERR(&(qedf->dbg_ctx),
794 "fc_frame_alloc failure.\n"); 795 "fc_frame_alloc failure.\n");
795 goto out_free; 796 goto out_put;
796 } 797 }
797 798
798 /* Copy frame header from firmware into fp */ 799 /* Copy frame header from firmware into fp */
@@ -884,9 +885,10 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
884 885
885out_free_frame: 886out_free_frame:
886 fc_frame_free(fp); 887 fc_frame_free(fp);
887out_free: 888out_put:
888 /* Put reference for original command since REC completed */ 889 /* Put reference for original command since REC completed */
889 kref_put(&orig_io_req->refcount, qedf_release_cmd); 890 kref_put(&orig_io_req->refcount, qedf_release_cmd);
891out_free:
890 kfree(cb_arg); 892 kfree(cb_arg);
891} 893}
892 894
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index d7ff71e0c85c..84e782d8e7c3 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1021,7 +1021,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
1021 read_lock_irqsave(&sfp->rq_list_lock, iflags); 1021 read_lock_irqsave(&sfp->rq_list_lock, iflags);
1022 val = 0; 1022 val = 0;
1023 list_for_each_entry(srp, &sfp->rq_list, entry) { 1023 list_for_each_entry(srp, &sfp->rq_list, entry) {
1024 if (val > SG_MAX_QUEUE) 1024 if (val >= SG_MAX_QUEUE)
1025 break; 1025 break;
1026 memset(&rinfo[val], 0, SZ_SG_REQ_INFO); 1026 memset(&rinfo[val], 0, SZ_SG_REQ_INFO);
1027 rinfo[val].req_state = srp->done + 1; 1027 rinfo[val].req_state = srp->done + 1;