Skip to content

Commit c02bf3e

Browse files
committed
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
2 parents 0761fc1 + 47c4ccd commit c02bf3e

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

drivers/scsi/ipr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4945,6 +4945,7 @@ static int ipr_slave_configure(struct scsi_device *sdev)
49454945
}
49464946
if (ipr_is_vset_device(res)) {
49474947
sdev->scsi_level = SCSI_SPC_3;
4948+
sdev->no_report_opcodes = 1;
49484949
blk_queue_rq_timeout(sdev->request_queue,
49494950
IPR_VSET_RW_TIMEOUT);
49504951
blk_queue_max_hw_sectors(sdev->request_queue, IPR_VSET_MAX_SECTORS);

drivers/scsi/qedf/qedf_els.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
489489

490490
/* If a SRR times out, simply free resources */
491491
if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO)
492-
goto out_free;
492+
goto out_put;
493493

494494
/* Normalize response data into struct fc_frame */
495495
mp_req = &(srr_req->mp_req);
@@ -501,7 +501,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
501501
if (!fp) {
502502
QEDF_ERR(&(qedf->dbg_ctx),
503503
"fc_frame_alloc failure.\n");
504-
goto out_free;
504+
goto out_put;
505505
}
506506

507507
/* Copy frame header from firmware into fp */
@@ -526,9 +526,10 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
526526
}
527527

528528
fc_frame_free(fp);
529-
out_free:
529+
out_put:
530530
/* Put reference for original command since SRR completed */
531531
kref_put(&orig_io_req->refcount, qedf_release_cmd);
532+
out_free:
532533
kfree(cb_arg);
533534
}
534535

@@ -780,7 +781,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
780781

781782
/* If a REC times out, free resources */
782783
if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO)
783-
goto out_free;
784+
goto out_put;
784785

785786
/* Normalize response data into struct fc_frame */
786787
mp_req = &(rec_req->mp_req);
@@ -792,7 +793,7 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
792793
if (!fp) {
793794
QEDF_ERR(&(qedf->dbg_ctx),
794795
"fc_frame_alloc failure.\n");
795-
goto out_free;
796+
goto out_put;
796797
}
797798

798799
/* Copy frame header from firmware into fp */
@@ -884,9 +885,10 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
884885

885886
out_free_frame:
886887
fc_frame_free(fp);
887-
out_free:
888+
out_put:
888889
/* Put reference for original command since REC completed */
889890
kref_put(&orig_io_req->refcount, qedf_release_cmd);
891+
out_free:
890892
kfree(cb_arg);
891893
}
892894

drivers/scsi/sg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
10211021
read_lock_irqsave(&sfp->rq_list_lock, iflags);
10221022
val = 0;
10231023
list_for_each_entry(srp, &sfp->rq_list, entry) {
1024-
if (val > SG_MAX_QUEUE)
1024+
if (val >= SG_MAX_QUEUE)
10251025
break;
10261026
memset(&rinfo[val], 0, SZ_SG_REQ_INFO);
10271027
rinfo[val].req_state = srp->done + 1;

0 commit comments

Comments
 (0)