Skip to content

Commit cf00c55

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: "This is a set of minor qla and virto fixes plus one major regression fix (oops in all legacy host drivers)." * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: [SCSI] virtio_scsi: fix TMF use-after-free [SCSI] fix oops in all legacy host adapters caused by 6f381fa [SCSI] qla2xxx: Update version number to 8.04.00.03-k. [SCSI] qla2xxx: Properly check for current state after the fabric-login request. [SCSI] qla2xxx: Proper completion to scsi-ml for scsi status task_set_full and busy. [SCSI] qla2xxx: Block flash access from application when device is initialized for ISP82xx. [SCSI] qla2xxx: Fix reset time out as qla2xxx not ack to reset request.
2 parents 4a873f5 + e4594bb commit cf00c55

File tree

9 files changed

+57
-18
lines changed

9 files changed

+57
-18
lines changed

drivers/scsi/hosts.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
218218

219219
if (!shost->shost_gendev.parent)
220220
shost->shost_gendev.parent = dev ? dev : &platform_bus;
221+
if (!dma_dev)
222+
dma_dev = shost->shost_gendev.parent;
223+
221224
shost->dma_dev = dma_dev;
222225

223226
error = device_add(&shost->shost_gendev);

drivers/scsi/qla2xxx/qla_bsg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,9 @@ qla2x00_read_optrom(struct fc_bsg_job *bsg_job)
13671367
struct qla_hw_data *ha = vha->hw;
13681368
int rval = 0;
13691369

1370+
if (ha->flags.isp82xx_reset_hdlr_active)
1371+
return -EBUSY;
1372+
13701373
rval = qla2x00_optrom_setup(bsg_job, vha, 0);
13711374
if (rval)
13721375
return rval;

drivers/scsi/qla2xxx/qla_dbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* | Mailbox commands | 0x113e | 0x112c-0x112e |
1616
* | | | 0x113a |
1717
* | Device Discovery | 0x2086 | 0x2020-0x2022 |
18-
* | Queue Command and IO tracing | 0x302f | 0x3006,0x3008 |
18+
* | Queue Command and IO tracing | 0x3030 | 0x3006,0x3008 |
1919
* | | | 0x302d-0x302e |
2020
* | DPC Thread | 0x401c | |
2121
* | Async Events | 0x505d | 0x502b-0x502f |

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,13 +1715,24 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
17151715
res = DID_ERROR << 16;
17161716
break;
17171717
}
1718-
} else {
1718+
} else if (lscsi_status != SAM_STAT_TASK_SET_FULL &&
1719+
lscsi_status != SAM_STAT_BUSY) {
1720+
/*
1721+
* scsi status of task set and busy are considered to be
1722+
* task not completed.
1723+
*/
1724+
17191725
ql_dbg(ql_dbg_io, fcport->vha, 0x301f,
17201726
"Dropped frame(s) detected (0x%x "
1721-
"of 0x%x bytes).\n", resid, scsi_bufflen(cp));
1727+
"of 0x%x bytes).\n", resid,
1728+
scsi_bufflen(cp));
17221729

17231730
res = DID_ERROR << 16 | lscsi_status;
17241731
goto check_scsi_status;
1732+
} else {
1733+
ql_dbg(ql_dbg_io, fcport->vha, 0x3030,
1734+
"scsi_status: 0x%x, lscsi_status: 0x%x\n",
1735+
scsi_status, lscsi_status);
17251736
}
17261737

17271738
res = DID_OK << 16 | lscsi_status;

drivers/scsi/qla2xxx/qla_nx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3125,6 +3125,7 @@ qla82xx_need_reset_handler(scsi_qla_host_t *vha)
31253125
ql_log(ql_log_info, vha, 0x00b7,
31263126
"HW State: COLD/RE-INIT.\n");
31273127
qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_COLD);
3128+
qla82xx_set_rst_ready(ha);
31283129
if (ql2xmdenable) {
31293130
if (qla82xx_md_collect(vha))
31303131
ql_log(ql_log_warn, vha, 0xb02c,

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3577,9 +3577,25 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
35773577
continue;
35783578
/* Attempt a retry. */
35793579
status = 1;
3580-
} else
3580+
} else {
35813581
status = qla2x00_fabric_login(vha,
35823582
fcport, &next_loopid);
3583+
if (status == QLA_SUCCESS) {
3584+
int status2;
3585+
uint8_t opts;
3586+
3587+
opts = 0;
3588+
if (fcport->flags &
3589+
FCF_FCP2_DEVICE)
3590+
opts |= BIT_1;
3591+
status2 =
3592+
qla2x00_get_port_database(
3593+
vha, fcport,
3594+
opts);
3595+
if (status2 != QLA_SUCCESS)
3596+
status = 1;
3597+
}
3598+
}
35833599
} else
35843600
status = qla2x00_local_device_login(vha,
35853601
fcport);

drivers/scsi/qla2xxx/qla_sup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,9 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha)
10171017
!IS_CNA_CAPABLE(ha) && !IS_QLA2031(ha))
10181018
return;
10191019

1020+
if (ha->flags.isp82xx_reset_hdlr_active)
1021+
return;
1022+
10201023
ha->isp_ops->read_optrom(vha, (uint8_t *)&hdr,
10211024
ha->flt_region_npiv_conf << 2, sizeof(struct qla_npiv_header));
10221025
if (hdr.version == __constant_cpu_to_le16(0xffff))

drivers/scsi/qla2xxx/qla_version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
/*
88
* Driver version
99
*/
10-
#define QLA2XXX_VERSION "8.03.07.13-k"
10+
#define QLA2XXX_VERSION "8.04.00.03-k"
1111

1212
#define QLA_DRIVER_MAJOR_VER 8
13-
#define QLA_DRIVER_MINOR_VER 3
14-
#define QLA_DRIVER_PATCH_VER 7
13+
#define QLA_DRIVER_MINOR_VER 4
14+
#define QLA_DRIVER_PATCH_VER 0
1515
#define QLA_DRIVER_BETA_VER 3

drivers/scsi/virtio_scsi.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ static void virtscsi_complete_free(void *buf)
175175

176176
if (cmd->comp)
177177
complete_all(cmd->comp);
178-
mempool_free(cmd, virtscsi_cmd_pool);
178+
else
179+
mempool_free(cmd, virtscsi_cmd_pool);
179180
}
180181

181182
static void virtscsi_ctrl_done(struct virtqueue *vq)
@@ -311,21 +312,22 @@ static int virtscsi_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc)
311312
static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd)
312313
{
313314
DECLARE_COMPLETION_ONSTACK(comp);
314-
int ret;
315+
int ret = FAILED;
315316

316317
cmd->comp = &comp;
317-
ret = virtscsi_kick_cmd(vscsi, vscsi->ctrl_vq, cmd,
318-
sizeof cmd->req.tmf, sizeof cmd->resp.tmf,
319-
GFP_NOIO);
320-
if (ret < 0)
321-
return FAILED;
318+
if (virtscsi_kick_cmd(vscsi, vscsi->ctrl_vq, cmd,
319+
sizeof cmd->req.tmf, sizeof cmd->resp.tmf,
320+
GFP_NOIO) < 0)
321+
goto out;
322322

323323
wait_for_completion(&comp);
324-
if (cmd->resp.tmf.response != VIRTIO_SCSI_S_OK &&
325-
cmd->resp.tmf.response != VIRTIO_SCSI_S_FUNCTION_SUCCEEDED)
326-
return FAILED;
324+
if (cmd->resp.tmf.response == VIRTIO_SCSI_S_OK ||
325+
cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED)
326+
ret = SUCCESS;
327327

328-
return SUCCESS;
328+
out:
329+
mempool_free(cmd, virtscsi_cmd_pool);
330+
return ret;
329331
}
330332

331333
static int virtscsi_device_reset(struct scsi_cmnd *sc)

0 commit comments

Comments
 (0)