aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-20 14:47:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-20 14:47:08 -0400
commit18cadf9f370735512eb8254beab77e26297a0e33 (patch)
tree6467a3049c0dea263797fcf3f32a71298def4b99
parent47736af324fc47598afdf3407467da7eaa65c86a (diff)
parent943e59fe78ee870d86c775fc9fee2ab68bd262a3 (diff)
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "A set of 8 obvious fixes. Three (2 qla2xxx and the cxlflash oopses) are regressions, two from 4.17 and one from the merge window. The hpsa change is user visible, but it fixes an error users have complained about" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: cxlflash: fix assignment of the backend operations scsi: qedi: Send driver state to MFW scsi: qedf: Send the driver state to MFW scsi: hpsa: correct enclosure sas address scsi: sd_zbc: Fix variable type and bogus comment scsi: qla2xxx: Fix NULL pointer dereference for fcport search scsi: qla2xxx: Fix kernel crash due to late workqueue allocation scsi: qla2xxx: Fix inconsistent DMA mem alloc/free
-rw-r--r--drivers/scsi/cxlflash/main.h4
-rw-r--r--drivers/scsi/hpsa.c25
-rw-r--r--drivers/scsi/hpsa.h1
-rw-r--r--drivers/scsi/qedf/qedf_main.c12
-rw-r--r--drivers/scsi/qedi/qedi_main.c11
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h2
-rw-r--r--drivers/scsi/qla2xxx/qla_gs.c40
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c14
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c4
-rw-r--r--drivers/scsi/sd_zbc.c5
10 files changed, 88 insertions, 30 deletions
diff --git a/drivers/scsi/cxlflash/main.h b/drivers/scsi/cxlflash/main.h
index 2a3977823812..a39be94d110c 100644
--- a/drivers/scsi/cxlflash/main.h
+++ b/drivers/scsi/cxlflash/main.h
@@ -107,12 +107,12 @@ cxlflash_assign_ops(struct dev_dependent_vals *ddv)
107{ 107{
108 const struct cxlflash_backend_ops *ops = NULL; 108 const struct cxlflash_backend_ops *ops = NULL;
109 109
110#ifdef CONFIG_OCXL 110#ifdef CONFIG_OCXL_BASE
111 if (ddv->flags & CXLFLASH_OCXL_DEV) 111 if (ddv->flags & CXLFLASH_OCXL_DEV)
112 ops = &cxlflash_ocxl_ops; 112 ops = &cxlflash_ocxl_ops;
113#endif 113#endif
114 114
115#ifdef CONFIG_CXL 115#ifdef CONFIG_CXL_BASE
116 if (!(ddv->flags & CXLFLASH_OCXL_DEV)) 116 if (!(ddv->flags & CXLFLASH_OCXL_DEV))
117 ops = &cxlflash_cxl_ops; 117 ops = &cxlflash_cxl_ops;
118#endif 118#endif
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 15c7f3b6f35e..58bb70b886d7 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3440,11 +3440,11 @@ static void hpsa_get_enclosure_info(struct ctlr_info *h,
3440 struct ext_report_lun_entry *rle = &rlep->LUN[rle_index]; 3440 struct ext_report_lun_entry *rle = &rlep->LUN[rle_index];
3441 u16 bmic_device_index = 0; 3441 u16 bmic_device_index = 0;
3442 3442
3443 bmic_device_index = GET_BMIC_DRIVE_NUMBER(&rle->lunid[0]); 3443 encl_dev->eli =
3444
3445 encl_dev->sas_address =
3446 hpsa_get_enclosure_logical_identifier(h, scsi3addr); 3444 hpsa_get_enclosure_logical_identifier(h, scsi3addr);
3447 3445
3446 bmic_device_index = GET_BMIC_DRIVE_NUMBER(&rle->lunid[0]);
3447
3448 if (encl_dev->target == -1 || encl_dev->lun == -1) { 3448 if (encl_dev->target == -1 || encl_dev->lun == -1) {
3449 rc = IO_OK; 3449 rc = IO_OK;
3450 goto out; 3450 goto out;
@@ -9697,7 +9697,24 @@ hpsa_sas_get_linkerrors(struct sas_phy *phy)
9697static int 9697static int
9698hpsa_sas_get_enclosure_identifier(struct sas_rphy *rphy, u64 *identifier) 9698hpsa_sas_get_enclosure_identifier(struct sas_rphy *rphy, u64 *identifier)
9699{ 9699{
9700 *identifier = rphy->identify.sas_address; 9700 struct Scsi_Host *shost = phy_to_shost(rphy);
9701 struct ctlr_info *h;
9702 struct hpsa_scsi_dev_t *sd;
9703
9704 if (!shost)
9705 return -ENXIO;
9706
9707 h = shost_to_hba(shost);
9708
9709 if (!h)
9710 return -ENXIO;
9711
9712 sd = hpsa_find_device_by_sas_rphy(h, rphy);
9713 if (!sd)
9714 return -ENXIO;
9715
9716 *identifier = sd->eli;
9717
9701 return 0; 9718 return 0;
9702} 9719}
9703 9720
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
index fb9f5e7f8209..59e023696fff 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -68,6 +68,7 @@ struct hpsa_scsi_dev_t {
68#define RAID_CTLR_LUNID "\0\0\0\0\0\0\0\0" 68#define RAID_CTLR_LUNID "\0\0\0\0\0\0\0\0"
69 unsigned char device_id[16]; /* from inquiry pg. 0x83 */ 69 unsigned char device_id[16]; /* from inquiry pg. 0x83 */
70 u64 sas_address; 70 u64 sas_address;
71 u64 eli; /* from report diags. */
71 unsigned char vendor[8]; /* bytes 8-15 of inquiry data */ 72 unsigned char vendor[8]; /* bytes 8-15 of inquiry data */
72 unsigned char model[16]; /* bytes 16-31 of inquiry data */ 73 unsigned char model[16]; /* bytes 16-31 of inquiry data */
73 unsigned char rev; /* byte 2 of inquiry data */ 74 unsigned char rev; /* byte 2 of inquiry data */
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 90394cef0f41..0a5dd5595dd3 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -3295,6 +3295,11 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
3295 3295
3296 init_completion(&qedf->flogi_compl); 3296 init_completion(&qedf->flogi_compl);
3297 3297
3298 status = qed_ops->common->update_drv_state(qedf->cdev, true);
3299 if (status)
3300 QEDF_ERR(&(qedf->dbg_ctx),
3301 "Failed to send drv state to MFW.\n");
3302
3298 memset(&link_params, 0, sizeof(struct qed_link_params)); 3303 memset(&link_params, 0, sizeof(struct qed_link_params));
3299 link_params.link_up = true; 3304 link_params.link_up = true;
3300 status = qed_ops->common->set_link(qedf->cdev, &link_params); 3305 status = qed_ops->common->set_link(qedf->cdev, &link_params);
@@ -3343,6 +3348,7 @@ static int qedf_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3343static void __qedf_remove(struct pci_dev *pdev, int mode) 3348static void __qedf_remove(struct pci_dev *pdev, int mode)
3344{ 3349{
3345 struct qedf_ctx *qedf; 3350 struct qedf_ctx *qedf;
3351 int rc;
3346 3352
3347 if (!pdev) { 3353 if (!pdev) {
3348 QEDF_ERR(NULL, "pdev is NULL.\n"); 3354 QEDF_ERR(NULL, "pdev is NULL.\n");
@@ -3437,6 +3443,12 @@ static void __qedf_remove(struct pci_dev *pdev, int mode)
3437 qed_ops->common->set_power_state(qedf->cdev, PCI_D0); 3443 qed_ops->common->set_power_state(qedf->cdev, PCI_D0);
3438 pci_set_drvdata(pdev, NULL); 3444 pci_set_drvdata(pdev, NULL);
3439 } 3445 }
3446
3447 rc = qed_ops->common->update_drv_state(qedf->cdev, false);
3448 if (rc)
3449 QEDF_ERR(&(qedf->dbg_ctx),
3450 "Failed to send drv state to MFW.\n");
3451
3440 qed_ops->common->slowpath_stop(qedf->cdev); 3452 qed_ops->common->slowpath_stop(qedf->cdev);
3441 qed_ops->common->remove(qedf->cdev); 3453 qed_ops->common->remove(qedf->cdev);
3442 3454
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index cf274a79e77a..091ec1207bea 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -2273,6 +2273,7 @@ kset_free:
2273static void __qedi_remove(struct pci_dev *pdev, int mode) 2273static void __qedi_remove(struct pci_dev *pdev, int mode)
2274{ 2274{
2275 struct qedi_ctx *qedi = pci_get_drvdata(pdev); 2275 struct qedi_ctx *qedi = pci_get_drvdata(pdev);
2276 int rval;
2276 2277
2277 if (qedi->tmf_thread) { 2278 if (qedi->tmf_thread) {
2278 flush_workqueue(qedi->tmf_thread); 2279 flush_workqueue(qedi->tmf_thread);
@@ -2302,6 +2303,10 @@ static void __qedi_remove(struct pci_dev *pdev, int mode)
2302 if (mode == QEDI_MODE_NORMAL) 2303 if (mode == QEDI_MODE_NORMAL)
2303 qedi_free_iscsi_pf_param(qedi); 2304 qedi_free_iscsi_pf_param(qedi);
2304 2305
2306 rval = qedi_ops->common->update_drv_state(qedi->cdev, false);
2307 if (rval)
2308 QEDI_ERR(&qedi->dbg_ctx, "Failed to send drv state to MFW\n");
2309
2305 if (!test_bit(QEDI_IN_OFFLINE, &qedi->flags)) { 2310 if (!test_bit(QEDI_IN_OFFLINE, &qedi->flags)) {
2306 qedi_ops->common->slowpath_stop(qedi->cdev); 2311 qedi_ops->common->slowpath_stop(qedi->cdev);
2307 qedi_ops->common->remove(qedi->cdev); 2312 qedi_ops->common->remove(qedi->cdev);
@@ -2576,6 +2581,12 @@ static int __qedi_probe(struct pci_dev *pdev, int mode)
2576 if (qedi_setup_boot_info(qedi)) 2581 if (qedi_setup_boot_info(qedi))
2577 QEDI_ERR(&qedi->dbg_ctx, 2582 QEDI_ERR(&qedi->dbg_ctx,
2578 "No iSCSI boot target configured\n"); 2583 "No iSCSI boot target configured\n");
2584
2585 rc = qedi_ops->common->update_drv_state(qedi->cdev, true);
2586 if (rc)
2587 QEDI_ERR(&qedi->dbg_ctx,
2588 "Failed to send drv state to MFW\n");
2589
2579 } 2590 }
2580 2591
2581 return 0; 2592 return 0;
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 9442e18aef6f..0f94b1d62d3f 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -361,6 +361,8 @@ struct ct_arg {
361 dma_addr_t rsp_dma; 361 dma_addr_t rsp_dma;
362 u32 req_size; 362 u32 req_size;
363 u32 rsp_size; 363 u32 rsp_size;
364 u32 req_allocated_size;
365 u32 rsp_allocated_size;
364 void *req; 366 void *req;
365 void *rsp; 367 void *rsp;
366 port_id_t id; 368 port_id_t id;
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 4bc2b66b299f..2c35b0b2baa0 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -556,7 +556,7 @@ err2:
556 /* please ignore kernel warning. otherwise, we have mem leak. */ 556 /* please ignore kernel warning. otherwise, we have mem leak. */
557 if (sp->u.iocb_cmd.u.ctarg.req) { 557 if (sp->u.iocb_cmd.u.ctarg.req) {
558 dma_free_coherent(&vha->hw->pdev->dev, 558 dma_free_coherent(&vha->hw->pdev->dev,
559 sizeof(struct ct_sns_pkt), 559 sp->u.iocb_cmd.u.ctarg.req_allocated_size,
560 sp->u.iocb_cmd.u.ctarg.req, 560 sp->u.iocb_cmd.u.ctarg.req,
561 sp->u.iocb_cmd.u.ctarg.req_dma); 561 sp->u.iocb_cmd.u.ctarg.req_dma);
562 sp->u.iocb_cmd.u.ctarg.req = NULL; 562 sp->u.iocb_cmd.u.ctarg.req = NULL;
@@ -564,7 +564,7 @@ err2:
564 564
565 if (sp->u.iocb_cmd.u.ctarg.rsp) { 565 if (sp->u.iocb_cmd.u.ctarg.rsp) {
566 dma_free_coherent(&vha->hw->pdev->dev, 566 dma_free_coherent(&vha->hw->pdev->dev,
567 sizeof(struct ct_sns_pkt), 567 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
568 sp->u.iocb_cmd.u.ctarg.rsp, 568 sp->u.iocb_cmd.u.ctarg.rsp,
569 sp->u.iocb_cmd.u.ctarg.rsp_dma); 569 sp->u.iocb_cmd.u.ctarg.rsp_dma);
570 sp->u.iocb_cmd.u.ctarg.rsp = NULL; 570 sp->u.iocb_cmd.u.ctarg.rsp = NULL;
@@ -617,6 +617,7 @@ static int qla_async_rftid(scsi_qla_host_t *vha, port_id_t *d_id)
617 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, 617 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
618 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, 618 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
619 GFP_KERNEL); 619 GFP_KERNEL);
620 sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
620 if (!sp->u.iocb_cmd.u.ctarg.req) { 621 if (!sp->u.iocb_cmd.u.ctarg.req) {
621 ql_log(ql_log_warn, vha, 0xd041, 622 ql_log(ql_log_warn, vha, 0xd041,
622 "%s: Failed to allocate ct_sns request.\n", 623 "%s: Failed to allocate ct_sns request.\n",
@@ -627,6 +628,7 @@ static int qla_async_rftid(scsi_qla_host_t *vha, port_id_t *d_id)
627 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev, 628 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
628 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma, 629 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
629 GFP_KERNEL); 630 GFP_KERNEL);
631 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
630 if (!sp->u.iocb_cmd.u.ctarg.rsp) { 632 if (!sp->u.iocb_cmd.u.ctarg.rsp) {
631 ql_log(ql_log_warn, vha, 0xd042, 633 ql_log(ql_log_warn, vha, 0xd042,
632 "%s: Failed to allocate ct_sns request.\n", 634 "%s: Failed to allocate ct_sns request.\n",
@@ -712,6 +714,7 @@ static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id,
712 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, 714 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
713 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, 715 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
714 GFP_KERNEL); 716 GFP_KERNEL);
717 sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
715 if (!sp->u.iocb_cmd.u.ctarg.req) { 718 if (!sp->u.iocb_cmd.u.ctarg.req) {
716 ql_log(ql_log_warn, vha, 0xd041, 719 ql_log(ql_log_warn, vha, 0xd041,
717 "%s: Failed to allocate ct_sns request.\n", 720 "%s: Failed to allocate ct_sns request.\n",
@@ -722,6 +725,7 @@ static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id,
722 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev, 725 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
723 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma, 726 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
724 GFP_KERNEL); 727 GFP_KERNEL);
728 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
725 if (!sp->u.iocb_cmd.u.ctarg.rsp) { 729 if (!sp->u.iocb_cmd.u.ctarg.rsp) {
726 ql_log(ql_log_warn, vha, 0xd042, 730 ql_log(ql_log_warn, vha, 0xd042,
727 "%s: Failed to allocate ct_sns request.\n", 731 "%s: Failed to allocate ct_sns request.\n",
@@ -802,6 +806,7 @@ static int qla_async_rnnid(scsi_qla_host_t *vha, port_id_t *d_id,
802 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, 806 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
803 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, 807 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
804 GFP_KERNEL); 808 GFP_KERNEL);
809 sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
805 if (!sp->u.iocb_cmd.u.ctarg.req) { 810 if (!sp->u.iocb_cmd.u.ctarg.req) {
806 ql_log(ql_log_warn, vha, 0xd041, 811 ql_log(ql_log_warn, vha, 0xd041,
807 "%s: Failed to allocate ct_sns request.\n", 812 "%s: Failed to allocate ct_sns request.\n",
@@ -812,6 +817,7 @@ static int qla_async_rnnid(scsi_qla_host_t *vha, port_id_t *d_id,
812 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev, 817 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
813 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma, 818 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
814 GFP_KERNEL); 819 GFP_KERNEL);
820 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
815 if (!sp->u.iocb_cmd.u.ctarg.rsp) { 821 if (!sp->u.iocb_cmd.u.ctarg.rsp) {
816 ql_log(ql_log_warn, vha, 0xd042, 822 ql_log(ql_log_warn, vha, 0xd042,
817 "%s: Failed to allocate ct_sns request.\n", 823 "%s: Failed to allocate ct_sns request.\n",
@@ -909,6 +915,7 @@ static int qla_async_rsnn_nn(scsi_qla_host_t *vha)
909 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, 915 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
910 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, 916 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
911 GFP_KERNEL); 917 GFP_KERNEL);
918 sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
912 if (!sp->u.iocb_cmd.u.ctarg.req) { 919 if (!sp->u.iocb_cmd.u.ctarg.req) {
913 ql_log(ql_log_warn, vha, 0xd041, 920 ql_log(ql_log_warn, vha, 0xd041,
914 "%s: Failed to allocate ct_sns request.\n", 921 "%s: Failed to allocate ct_sns request.\n",
@@ -919,6 +926,7 @@ static int qla_async_rsnn_nn(scsi_qla_host_t *vha)
919 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev, 926 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
920 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma, 927 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
921 GFP_KERNEL); 928 GFP_KERNEL);
929 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
922 if (!sp->u.iocb_cmd.u.ctarg.rsp) { 930 if (!sp->u.iocb_cmd.u.ctarg.rsp) {
923 ql_log(ql_log_warn, vha, 0xd042, 931 ql_log(ql_log_warn, vha, 0xd042,
924 "%s: Failed to allocate ct_sns request.\n", 932 "%s: Failed to allocate ct_sns request.\n",
@@ -3388,14 +3396,14 @@ void qla24xx_sp_unmap(scsi_qla_host_t *vha, srb_t *sp)
3388{ 3396{
3389 if (sp->u.iocb_cmd.u.ctarg.req) { 3397 if (sp->u.iocb_cmd.u.ctarg.req) {
3390 dma_free_coherent(&vha->hw->pdev->dev, 3398 dma_free_coherent(&vha->hw->pdev->dev,
3391 sizeof(struct ct_sns_pkt), 3399 sp->u.iocb_cmd.u.ctarg.req_allocated_size,
3392 sp->u.iocb_cmd.u.ctarg.req, 3400 sp->u.iocb_cmd.u.ctarg.req,
3393 sp->u.iocb_cmd.u.ctarg.req_dma); 3401 sp->u.iocb_cmd.u.ctarg.req_dma);
3394 sp->u.iocb_cmd.u.ctarg.req = NULL; 3402 sp->u.iocb_cmd.u.ctarg.req = NULL;
3395 } 3403 }
3396 if (sp->u.iocb_cmd.u.ctarg.rsp) { 3404 if (sp->u.iocb_cmd.u.ctarg.rsp) {
3397 dma_free_coherent(&vha->hw->pdev->dev, 3405 dma_free_coherent(&vha->hw->pdev->dev,
3398 sizeof(struct ct_sns_pkt), 3406 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
3399 sp->u.iocb_cmd.u.ctarg.rsp, 3407 sp->u.iocb_cmd.u.ctarg.rsp,
3400 sp->u.iocb_cmd.u.ctarg.rsp_dma); 3408 sp->u.iocb_cmd.u.ctarg.rsp_dma);
3401 sp->u.iocb_cmd.u.ctarg.rsp = NULL; 3409 sp->u.iocb_cmd.u.ctarg.rsp = NULL;
@@ -3596,14 +3604,14 @@ static void qla2x00_async_gpnid_sp_done(void *s, int res)
3596 /* please ignore kernel warning. otherwise, we have mem leak. */ 3604 /* please ignore kernel warning. otherwise, we have mem leak. */
3597 if (sp->u.iocb_cmd.u.ctarg.req) { 3605 if (sp->u.iocb_cmd.u.ctarg.req) {
3598 dma_free_coherent(&vha->hw->pdev->dev, 3606 dma_free_coherent(&vha->hw->pdev->dev,
3599 sizeof(struct ct_sns_pkt), 3607 sp->u.iocb_cmd.u.ctarg.req_allocated_size,
3600 sp->u.iocb_cmd.u.ctarg.req, 3608 sp->u.iocb_cmd.u.ctarg.req,
3601 sp->u.iocb_cmd.u.ctarg.req_dma); 3609 sp->u.iocb_cmd.u.ctarg.req_dma);
3602 sp->u.iocb_cmd.u.ctarg.req = NULL; 3610 sp->u.iocb_cmd.u.ctarg.req = NULL;
3603 } 3611 }
3604 if (sp->u.iocb_cmd.u.ctarg.rsp) { 3612 if (sp->u.iocb_cmd.u.ctarg.rsp) {
3605 dma_free_coherent(&vha->hw->pdev->dev, 3613 dma_free_coherent(&vha->hw->pdev->dev,
3606 sizeof(struct ct_sns_pkt), 3614 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
3607 sp->u.iocb_cmd.u.ctarg.rsp, 3615 sp->u.iocb_cmd.u.ctarg.rsp,
3608 sp->u.iocb_cmd.u.ctarg.rsp_dma); 3616 sp->u.iocb_cmd.u.ctarg.rsp_dma);
3609 sp->u.iocb_cmd.u.ctarg.rsp = NULL; 3617 sp->u.iocb_cmd.u.ctarg.rsp = NULL;
@@ -3654,6 +3662,7 @@ int qla24xx_async_gpnid(scsi_qla_host_t *vha, port_id_t *id)
3654 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, 3662 sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
3655 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, 3663 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma,
3656 GFP_KERNEL); 3664 GFP_KERNEL);
3665 sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
3657 if (!sp->u.iocb_cmd.u.ctarg.req) { 3666 if (!sp->u.iocb_cmd.u.ctarg.req) {
3658 ql_log(ql_log_warn, vha, 0xd041, 3667 ql_log(ql_log_warn, vha, 0xd041,
3659 "Failed to allocate ct_sns request.\n"); 3668 "Failed to allocate ct_sns request.\n");
@@ -3663,6 +3672,7 @@ int qla24xx_async_gpnid(scsi_qla_host_t *vha, port_id_t *id)
3663 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev, 3672 sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
3664 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma, 3673 sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma,
3665 GFP_KERNEL); 3674 GFP_KERNEL);
3675 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
3666 if (!sp->u.iocb_cmd.u.ctarg.rsp) { 3676 if (!sp->u.iocb_cmd.u.ctarg.rsp) {
3667 ql_log(ql_log_warn, vha, 0xd042, 3677 ql_log(ql_log_warn, vha, 0xd042,
3668 "Failed to allocate ct_sns request.\n"); 3678 "Failed to allocate ct_sns request.\n");
@@ -4142,14 +4152,14 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res)
4142 */ 4152 */
4143 if (sp->u.iocb_cmd.u.ctarg.req) { 4153 if (sp->u.iocb_cmd.u.ctarg.req) {
4144 dma_free_coherent(&vha->hw->pdev->dev, 4154 dma_free_coherent(&vha->hw->pdev->dev,
4145 sizeof(struct ct_sns_pkt), 4155 sp->u.iocb_cmd.u.ctarg.req_allocated_size,
4146 sp->u.iocb_cmd.u.ctarg.req, 4156 sp->u.iocb_cmd.u.ctarg.req,
4147 sp->u.iocb_cmd.u.ctarg.req_dma); 4157 sp->u.iocb_cmd.u.ctarg.req_dma);
4148 sp->u.iocb_cmd.u.ctarg.req = NULL; 4158 sp->u.iocb_cmd.u.ctarg.req = NULL;
4149 } 4159 }
4150 if (sp->u.iocb_cmd.u.ctarg.rsp) { 4160 if (sp->u.iocb_cmd.u.ctarg.rsp) {
4151 dma_free_coherent(&vha->hw->pdev->dev, 4161 dma_free_coherent(&vha->hw->pdev->dev,
4152 sizeof(struct ct_sns_pkt), 4162 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
4153 sp->u.iocb_cmd.u.ctarg.rsp, 4163 sp->u.iocb_cmd.u.ctarg.rsp,
4154 sp->u.iocb_cmd.u.ctarg.rsp_dma); 4164 sp->u.iocb_cmd.u.ctarg.rsp_dma);
4155 sp->u.iocb_cmd.u.ctarg.rsp = NULL; 4165 sp->u.iocb_cmd.u.ctarg.rsp = NULL;
@@ -4179,14 +4189,14 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res)
4179 /* please ignore kernel warning. Otherwise, we have mem leak. */ 4189 /* please ignore kernel warning. Otherwise, we have mem leak. */
4180 if (sp->u.iocb_cmd.u.ctarg.req) { 4190 if (sp->u.iocb_cmd.u.ctarg.req) {
4181 dma_free_coherent(&vha->hw->pdev->dev, 4191 dma_free_coherent(&vha->hw->pdev->dev,
4182 sizeof(struct ct_sns_pkt), 4192 sp->u.iocb_cmd.u.ctarg.req_allocated_size,
4183 sp->u.iocb_cmd.u.ctarg.req, 4193 sp->u.iocb_cmd.u.ctarg.req,
4184 sp->u.iocb_cmd.u.ctarg.req_dma); 4194 sp->u.iocb_cmd.u.ctarg.req_dma);
4185 sp->u.iocb_cmd.u.ctarg.req = NULL; 4195 sp->u.iocb_cmd.u.ctarg.req = NULL;
4186 } 4196 }
4187 if (sp->u.iocb_cmd.u.ctarg.rsp) { 4197 if (sp->u.iocb_cmd.u.ctarg.rsp) {
4188 dma_free_coherent(&vha->hw->pdev->dev, 4198 dma_free_coherent(&vha->hw->pdev->dev,
4189 sizeof(struct ct_sns_pkt), 4199 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
4190 sp->u.iocb_cmd.u.ctarg.rsp, 4200 sp->u.iocb_cmd.u.ctarg.rsp,
4191 sp->u.iocb_cmd.u.ctarg.rsp_dma); 4201 sp->u.iocb_cmd.u.ctarg.rsp_dma);
4192 sp->u.iocb_cmd.u.ctarg.rsp = NULL; 4202 sp->u.iocb_cmd.u.ctarg.rsp = NULL;
@@ -4281,14 +4291,14 @@ static int qla24xx_async_gnnft(scsi_qla_host_t *vha, struct srb *sp,
4281done_free_sp: 4291done_free_sp:
4282 if (sp->u.iocb_cmd.u.ctarg.req) { 4292 if (sp->u.iocb_cmd.u.ctarg.req) {
4283 dma_free_coherent(&vha->hw->pdev->dev, 4293 dma_free_coherent(&vha->hw->pdev->dev,
4284 sizeof(struct ct_sns_pkt), 4294 sp->u.iocb_cmd.u.ctarg.req_allocated_size,
4285 sp->u.iocb_cmd.u.ctarg.req, 4295 sp->u.iocb_cmd.u.ctarg.req,
4286 sp->u.iocb_cmd.u.ctarg.req_dma); 4296 sp->u.iocb_cmd.u.ctarg.req_dma);
4287 sp->u.iocb_cmd.u.ctarg.req = NULL; 4297 sp->u.iocb_cmd.u.ctarg.req = NULL;
4288 } 4298 }
4289 if (sp->u.iocb_cmd.u.ctarg.rsp) { 4299 if (sp->u.iocb_cmd.u.ctarg.rsp) {
4290 dma_free_coherent(&vha->hw->pdev->dev, 4300 dma_free_coherent(&vha->hw->pdev->dev,
4291 sizeof(struct ct_sns_pkt), 4301 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
4292 sp->u.iocb_cmd.u.ctarg.rsp, 4302 sp->u.iocb_cmd.u.ctarg.rsp,
4293 sp->u.iocb_cmd.u.ctarg.rsp_dma); 4303 sp->u.iocb_cmd.u.ctarg.rsp_dma);
4294 sp->u.iocb_cmd.u.ctarg.rsp = NULL; 4304 sp->u.iocb_cmd.u.ctarg.rsp = NULL;
@@ -4349,6 +4359,7 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)
4349 sp->u.iocb_cmd.u.ctarg.req = dma_zalloc_coherent( 4359 sp->u.iocb_cmd.u.ctarg.req = dma_zalloc_coherent(
4350 &vha->hw->pdev->dev, sizeof(struct ct_sns_pkt), 4360 &vha->hw->pdev->dev, sizeof(struct ct_sns_pkt),
4351 &sp->u.iocb_cmd.u.ctarg.req_dma, GFP_KERNEL); 4361 &sp->u.iocb_cmd.u.ctarg.req_dma, GFP_KERNEL);
4362 sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
4352 if (!sp->u.iocb_cmd.u.ctarg.req) { 4363 if (!sp->u.iocb_cmd.u.ctarg.req) {
4353 ql_log(ql_log_warn, vha, 0xffff, 4364 ql_log(ql_log_warn, vha, 0xffff,
4354 "Failed to allocate ct_sns request.\n"); 4365 "Failed to allocate ct_sns request.\n");
@@ -4366,6 +4377,7 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)
4366 sp->u.iocb_cmd.u.ctarg.rsp = dma_zalloc_coherent( 4377 sp->u.iocb_cmd.u.ctarg.rsp = dma_zalloc_coherent(
4367 &vha->hw->pdev->dev, rspsz, 4378 &vha->hw->pdev->dev, rspsz,
4368 &sp->u.iocb_cmd.u.ctarg.rsp_dma, GFP_KERNEL); 4379 &sp->u.iocb_cmd.u.ctarg.rsp_dma, GFP_KERNEL);
4380 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
4369 if (!sp->u.iocb_cmd.u.ctarg.rsp) { 4381 if (!sp->u.iocb_cmd.u.ctarg.rsp) {
4370 ql_log(ql_log_warn, vha, 0xffff, 4382 ql_log(ql_log_warn, vha, 0xffff,
4371 "Failed to allocate ct_sns request.\n"); 4383 "Failed to allocate ct_sns request.\n");
@@ -4425,14 +4437,14 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)
4425done_free_sp: 4437done_free_sp:
4426 if (sp->u.iocb_cmd.u.ctarg.req) { 4438 if (sp->u.iocb_cmd.u.ctarg.req) {
4427 dma_free_coherent(&vha->hw->pdev->dev, 4439 dma_free_coherent(&vha->hw->pdev->dev,
4428 sizeof(struct ct_sns_pkt), 4440 sp->u.iocb_cmd.u.ctarg.req_allocated_size,
4429 sp->u.iocb_cmd.u.ctarg.req, 4441 sp->u.iocb_cmd.u.ctarg.req,
4430 sp->u.iocb_cmd.u.ctarg.req_dma); 4442 sp->u.iocb_cmd.u.ctarg.req_dma);
4431 sp->u.iocb_cmd.u.ctarg.req = NULL; 4443 sp->u.iocb_cmd.u.ctarg.req = NULL;
4432 } 4444 }
4433 if (sp->u.iocb_cmd.u.ctarg.rsp) { 4445 if (sp->u.iocb_cmd.u.ctarg.rsp) {
4434 dma_free_coherent(&vha->hw->pdev->dev, 4446 dma_free_coherent(&vha->hw->pdev->dev,
4435 sizeof(struct ct_sns_pkt), 4447 sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
4436 sp->u.iocb_cmd.u.ctarg.rsp, 4448 sp->u.iocb_cmd.u.ctarg.rsp,
4437 sp->u.iocb_cmd.u.ctarg.rsp_dma); 4449 sp->u.iocb_cmd.u.ctarg.rsp_dma);
4438 sp->u.iocb_cmd.u.ctarg.rsp = NULL; 4450 sp->u.iocb_cmd.u.ctarg.rsp = NULL;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 7b675243bd16..db0e3279e07a 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -591,12 +591,14 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha,
591 conflict_fcport = 591 conflict_fcport =
592 qla2x00_find_fcport_by_wwpn(vha, 592 qla2x00_find_fcport_by_wwpn(vha,
593 e->port_name, 0); 593 e->port_name, 0);
594 ql_dbg(ql_dbg_disc, vha, 0x20e6, 594 if (conflict_fcport) {
595 "%s %d %8phC post del sess\n", 595 qlt_schedule_sess_for_deletion
596 __func__, __LINE__, 596 (conflict_fcport);
597 conflict_fcport->port_name); 597 ql_dbg(ql_dbg_disc, vha, 0x20e6,
598 qlt_schedule_sess_for_deletion 598 "%s %d %8phC post del sess\n",
599 (conflict_fcport); 599 __func__, __LINE__,
600 conflict_fcport->port_name);
601 }
600 } 602 }
601 603
602 /* FW already picked this loop id for another fcport */ 604 /* FW already picked this loop id for another fcport */
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index e881fce7477a..9f309e572be4 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3180,6 +3180,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
3180 "req->req_q_in=%p req->req_q_out=%p rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n", 3180 "req->req_q_in=%p req->req_q_out=%p rsp->rsp_q_in=%p rsp->rsp_q_out=%p.\n",
3181 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out); 3181 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out);
3182 3182
3183 ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0);
3184
3183 if (ha->isp_ops->initialize_adapter(base_vha)) { 3185 if (ha->isp_ops->initialize_adapter(base_vha)) {
3184 ql_log(ql_log_fatal, base_vha, 0x00d6, 3186 ql_log(ql_log_fatal, base_vha, 0x00d6,
3185 "Failed to initialize adapter - Adapter flags %x.\n", 3187 "Failed to initialize adapter - Adapter flags %x.\n",
@@ -3216,8 +3218,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
3216 host->can_queue, base_vha->req, 3218 host->can_queue, base_vha->req,
3217 base_vha->mgmt_svr_loop_id, host->sg_tablesize); 3219 base_vha->mgmt_svr_loop_id, host->sg_tablesize);
3218 3220
3219 ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0);
3220
3221 if (ha->mqenable) { 3221 if (ha->mqenable) {
3222 bool mq = false; 3222 bool mq = false;
3223 bool startit = false; 3223 bool startit = false;
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index a14fef11776e..2bf3bf73886e 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -391,7 +391,8 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf)
391 * Check that all zones of the device are equal. The last zone can however 391 * Check that all zones of the device are equal. The last zone can however
392 * be smaller. The zone size must also be a power of two number of LBAs. 392 * be smaller. The zone size must also be a power of two number of LBAs.
393 * 393 *
394 * Returns the zone size in bytes upon success or an error code upon failure. 394 * Returns the zone size in number of blocks upon success or an error code
395 * upon failure.
395 */ 396 */
396static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp) 397static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp)
397{ 398{
@@ -401,7 +402,7 @@ static s64 sd_zbc_check_zone_size(struct scsi_disk *sdkp)
401 unsigned char *rec; 402 unsigned char *rec;
402 unsigned int buf_len; 403 unsigned int buf_len;
403 unsigned int list_length; 404 unsigned int list_length;
404 int ret; 405 s64 ret;
405 u8 same; 406 u8 same;
406 407
407 /* Get a buffer */ 408 /* Get a buffer */