diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/dma/edma.c | 2 | ||||
| -rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.c | 2 | ||||
| -rw-r--r-- | drivers/target/target_core_pscsi.c | 8 | ||||
| -rw-r--r-- | drivers/target/target_core_sbc.c | 5 | ||||
| -rw-r--r-- | drivers/target/target_core_xcopy.c | 53 | ||||
| -rw-r--r-- | drivers/vhost/scsi.c | 2 |
6 files changed, 50 insertions, 22 deletions
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 3519111c566b..10b577fcf48d 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c | |||
| @@ -305,6 +305,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg( | |||
| 305 | edma_alloc_slot(EDMA_CTLR(echan->ch_num), | 305 | edma_alloc_slot(EDMA_CTLR(echan->ch_num), |
| 306 | EDMA_SLOT_ANY); | 306 | EDMA_SLOT_ANY); |
| 307 | if (echan->slot[i] < 0) { | 307 | if (echan->slot[i] < 0) { |
| 308 | kfree(edesc); | ||
| 308 | dev_err(dev, "Failed to allocate slot\n"); | 309 | dev_err(dev, "Failed to allocate slot\n"); |
| 309 | kfree(edesc); | 310 | kfree(edesc); |
| 310 | return NULL; | 311 | return NULL; |
| @@ -346,6 +347,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg( | |||
| 346 | ccnt = sg_dma_len(sg) / (acnt * bcnt); | 347 | ccnt = sg_dma_len(sg) / (acnt * bcnt); |
| 347 | if (ccnt > (SZ_64K - 1)) { | 348 | if (ccnt > (SZ_64K - 1)) { |
| 348 | dev_err(dev, "Exceeded max SG segment size\n"); | 349 | dev_err(dev, "Exceeded max SG segment size\n"); |
| 350 | kfree(edesc); | ||
| 349 | return NULL; | 351 | return NULL; |
| 350 | } | 352 | } |
| 351 | cidx = acnt * bcnt; | 353 | cidx = acnt * bcnt; |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 3591855cc5b5..6df23502059a 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
| @@ -594,7 +594,7 @@ isert_connect_release(struct isert_conn *isert_conn) | |||
| 594 | 594 | ||
| 595 | pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); | 595 | pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); |
| 596 | 596 | ||
| 597 | if (device->use_frwr) | 597 | if (device && device->use_frwr) |
| 598 | isert_conn_free_frwr_pool(isert_conn); | 598 | isert_conn_free_frwr_pool(isert_conn); |
| 599 | 599 | ||
| 600 | if (isert_conn->conn_qp) { | 600 | if (isert_conn->conn_qp) { |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 551c96ca60ac..0f199f6a0738 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
| @@ -134,10 +134,10 @@ static int pscsi_pmode_enable_hba(struct se_hba *hba, unsigned long mode_flag) | |||
| 134 | * pSCSI Host ID and enable for phba mode | 134 | * pSCSI Host ID and enable for phba mode |
| 135 | */ | 135 | */ |
| 136 | sh = scsi_host_lookup(phv->phv_host_id); | 136 | sh = scsi_host_lookup(phv->phv_host_id); |
| 137 | if (IS_ERR(sh)) { | 137 | if (!sh) { |
| 138 | pr_err("pSCSI: Unable to locate SCSI Host for" | 138 | pr_err("pSCSI: Unable to locate SCSI Host for" |
| 139 | " phv_host_id: %d\n", phv->phv_host_id); | 139 | " phv_host_id: %d\n", phv->phv_host_id); |
| 140 | return PTR_ERR(sh); | 140 | return -EINVAL; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | phv->phv_lld_host = sh; | 143 | phv->phv_lld_host = sh; |
| @@ -515,10 +515,10 @@ static int pscsi_configure_device(struct se_device *dev) | |||
| 515 | sh = phv->phv_lld_host; | 515 | sh = phv->phv_lld_host; |
| 516 | } else { | 516 | } else { |
| 517 | sh = scsi_host_lookup(pdv->pdv_host_id); | 517 | sh = scsi_host_lookup(pdv->pdv_host_id); |
| 518 | if (IS_ERR(sh)) { | 518 | if (!sh) { |
| 519 | pr_err("pSCSI: Unable to locate" | 519 | pr_err("pSCSI: Unable to locate" |
| 520 | " pdv_host_id: %d\n", pdv->pdv_host_id); | 520 | " pdv_host_id: %d\n", pdv->pdv_host_id); |
| 521 | return PTR_ERR(sh); | 521 | return -EINVAL; |
| 522 | } | 522 | } |
| 523 | } | 523 | } |
| 524 | } else { | 524 | } else { |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 4714c6f8da4b..d9b92b2c524d 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
| @@ -263,6 +263,11 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o | |||
| 263 | sectors, cmd->se_dev->dev_attrib.max_write_same_len); | 263 | sectors, cmd->se_dev->dev_attrib.max_write_same_len); |
| 264 | return TCM_INVALID_CDB_FIELD; | 264 | return TCM_INVALID_CDB_FIELD; |
| 265 | } | 265 | } |
| 266 | /* We always have ANC_SUP == 0 so setting ANCHOR is always an error */ | ||
| 267 | if (flags[0] & 0x10) { | ||
| 268 | pr_warn("WRITE SAME with ANCHOR not supported\n"); | ||
| 269 | return TCM_INVALID_CDB_FIELD; | ||
| 270 | } | ||
| 266 | /* | 271 | /* |
| 267 | * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting | 272 | * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting |
| 268 | * translated into block discard requests within backend code. | 273 | * translated into block discard requests within backend code. |
diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 3da4fd10b9f8..474cd44fac14 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c | |||
| @@ -82,6 +82,9 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op | |||
| 82 | mutex_lock(&g_device_mutex); | 82 | mutex_lock(&g_device_mutex); |
| 83 | list_for_each_entry(se_dev, &g_device_list, g_dev_node) { | 83 | list_for_each_entry(se_dev, &g_device_list, g_dev_node) { |
| 84 | 84 | ||
| 85 | if (!se_dev->dev_attrib.emulate_3pc) | ||
| 86 | continue; | ||
| 87 | |||
| 85 | memset(&tmp_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); | 88 | memset(&tmp_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); |
| 86 | target_xcopy_gen_naa_ieee(se_dev, &tmp_dev_wwn[0]); | 89 | target_xcopy_gen_naa_ieee(se_dev, &tmp_dev_wwn[0]); |
| 87 | 90 | ||
| @@ -357,6 +360,7 @@ struct xcopy_pt_cmd { | |||
| 357 | struct se_cmd se_cmd; | 360 | struct se_cmd se_cmd; |
| 358 | struct xcopy_op *xcopy_op; | 361 | struct xcopy_op *xcopy_op; |
| 359 | struct completion xpt_passthrough_sem; | 362 | struct completion xpt_passthrough_sem; |
| 363 | unsigned char sense_buffer[TRANSPORT_SENSE_BUFFER]; | ||
| 360 | }; | 364 | }; |
| 361 | 365 | ||
| 362 | static struct se_port xcopy_pt_port; | 366 | static struct se_port xcopy_pt_port; |
| @@ -675,7 +679,8 @@ static int target_xcopy_issue_pt_cmd(struct xcopy_pt_cmd *xpt_cmd) | |||
| 675 | 679 | ||
| 676 | pr_debug("target_xcopy_issue_pt_cmd(): SCSI status: 0x%02x\n", | 680 | pr_debug("target_xcopy_issue_pt_cmd(): SCSI status: 0x%02x\n", |
| 677 | se_cmd->scsi_status); | 681 | se_cmd->scsi_status); |
| 678 | return 0; | 682 | |
| 683 | return (se_cmd->scsi_status) ? -EINVAL : 0; | ||
| 679 | } | 684 | } |
| 680 | 685 | ||
| 681 | static int target_xcopy_read_source( | 686 | static int target_xcopy_read_source( |
| @@ -708,7 +713,7 @@ static int target_xcopy_read_source( | |||
| 708 | (unsigned long long)src_lba, src_sectors, length); | 713 | (unsigned long long)src_lba, src_sectors, length); |
| 709 | 714 | ||
| 710 | transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, NULL, length, | 715 | transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, NULL, length, |
| 711 | DMA_FROM_DEVICE, 0, NULL); | 716 | DMA_FROM_DEVICE, 0, &xpt_cmd->sense_buffer[0]); |
| 712 | xop->src_pt_cmd = xpt_cmd; | 717 | xop->src_pt_cmd = xpt_cmd; |
| 713 | 718 | ||
| 714 | rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], | 719 | rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, src_dev, &cdb[0], |
| @@ -768,7 +773,7 @@ static int target_xcopy_write_destination( | |||
| 768 | (unsigned long long)dst_lba, dst_sectors, length); | 773 | (unsigned long long)dst_lba, dst_sectors, length); |
| 769 | 774 | ||
| 770 | transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, NULL, length, | 775 | transport_init_se_cmd(se_cmd, &xcopy_pt_tfo, NULL, length, |
| 771 | DMA_TO_DEVICE, 0, NULL); | 776 | DMA_TO_DEVICE, 0, &xpt_cmd->sense_buffer[0]); |
| 772 | xop->dst_pt_cmd = xpt_cmd; | 777 | xop->dst_pt_cmd = xpt_cmd; |
| 773 | 778 | ||
| 774 | rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, dst_dev, &cdb[0], | 779 | rc = target_xcopy_setup_pt_cmd(xpt_cmd, xop, dst_dev, &cdb[0], |
| @@ -884,30 +889,42 @@ out: | |||
| 884 | 889 | ||
| 885 | sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) | 890 | sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) |
| 886 | { | 891 | { |
| 892 | struct se_device *dev = se_cmd->se_dev; | ||
| 887 | struct xcopy_op *xop = NULL; | 893 | struct xcopy_op *xop = NULL; |
| 888 | unsigned char *p = NULL, *seg_desc; | 894 | unsigned char *p = NULL, *seg_desc; |
| 889 | unsigned int list_id, list_id_usage, sdll, inline_dl, sa; | 895 | unsigned int list_id, list_id_usage, sdll, inline_dl, sa; |
| 896 | sense_reason_t ret = TCM_INVALID_PARAMETER_LIST; | ||
| 890 | int rc; | 897 | int rc; |
| 891 | unsigned short tdll; | 898 | unsigned short tdll; |
| 892 | 899 | ||
| 900 | if (!dev->dev_attrib.emulate_3pc) { | ||
| 901 | pr_err("EXTENDED_COPY operation explicitly disabled\n"); | ||
| 902 | return TCM_UNSUPPORTED_SCSI_OPCODE; | ||
| 903 | } | ||
| 904 | |||
| 893 | sa = se_cmd->t_task_cdb[1] & 0x1f; | 905 | sa = se_cmd->t_task_cdb[1] & 0x1f; |
| 894 | if (sa != 0x00) { | 906 | if (sa != 0x00) { |
| 895 | pr_err("EXTENDED_COPY(LID4) not supported\n"); | 907 | pr_err("EXTENDED_COPY(LID4) not supported\n"); |
| 896 | return TCM_UNSUPPORTED_SCSI_OPCODE; | 908 | return TCM_UNSUPPORTED_SCSI_OPCODE; |
| 897 | } | 909 | } |
| 898 | 910 | ||
| 911 | xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); | ||
| 912 | if (!xop) { | ||
| 913 | pr_err("Unable to allocate xcopy_op\n"); | ||
| 914 | return TCM_OUT_OF_RESOURCES; | ||
| 915 | } | ||
| 916 | xop->xop_se_cmd = se_cmd; | ||
| 917 | |||
| 899 | p = transport_kmap_data_sg(se_cmd); | 918 | p = transport_kmap_data_sg(se_cmd); |
| 900 | if (!p) { | 919 | if (!p) { |
| 901 | pr_err("transport_kmap_data_sg() failed in target_do_xcopy\n"); | 920 | pr_err("transport_kmap_data_sg() failed in target_do_xcopy\n"); |
| 921 | kfree(xop); | ||
| 902 | return TCM_OUT_OF_RESOURCES; | 922 | return TCM_OUT_OF_RESOURCES; |
| 903 | } | 923 | } |
| 904 | 924 | ||
| 905 | list_id = p[0]; | 925 | list_id = p[0]; |
| 906 | if (list_id != 0x00) { | 926 | list_id_usage = (p[1] & 0x18) >> 3; |
| 907 | pr_err("XCOPY with non zero list_id: 0x%02x\n", list_id); | 927 | |
| 908 | goto out; | ||
| 909 | } | ||
| 910 | list_id_usage = (p[1] & 0x18); | ||
| 911 | /* | 928 | /* |
| 912 | * Determine TARGET DESCRIPTOR LIST LENGTH + SEGMENT DESCRIPTOR LIST LENGTH | 929 | * Determine TARGET DESCRIPTOR LIST LENGTH + SEGMENT DESCRIPTOR LIST LENGTH |
| 913 | */ | 930 | */ |
| @@ -920,13 +937,6 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) | |||
| 920 | goto out; | 937 | goto out; |
| 921 | } | 938 | } |
| 922 | 939 | ||
| 923 | xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); | ||
| 924 | if (!xop) { | ||
| 925 | pr_err("Unable to allocate xcopy_op\n"); | ||
| 926 | goto out; | ||
| 927 | } | ||
| 928 | xop->xop_se_cmd = se_cmd; | ||
| 929 | |||
| 930 | pr_debug("Processing XCOPY with list_id: 0x%02x list_id_usage: 0x%02x" | 940 | pr_debug("Processing XCOPY with list_id: 0x%02x list_id_usage: 0x%02x" |
| 931 | " tdll: %hu sdll: %u inline_dl: %u\n", list_id, list_id_usage, | 941 | " tdll: %hu sdll: %u inline_dl: %u\n", list_id, list_id_usage, |
| 932 | tdll, sdll, inline_dl); | 942 | tdll, sdll, inline_dl); |
| @@ -935,6 +945,17 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) | |||
| 935 | if (rc <= 0) | 945 | if (rc <= 0) |
| 936 | goto out; | 946 | goto out; |
| 937 | 947 | ||
| 948 | if (xop->src_dev->dev_attrib.block_size != | ||
| 949 | xop->dst_dev->dev_attrib.block_size) { | ||
| 950 | pr_err("XCOPY: Non matching src_dev block_size: %u + dst_dev" | ||
| 951 | " block_size: %u currently unsupported\n", | ||
| 952 | xop->src_dev->dev_attrib.block_size, | ||
| 953 | xop->dst_dev->dev_attrib.block_size); | ||
| 954 | xcopy_pt_undepend_remotedev(xop); | ||
| 955 | ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
| 956 | goto out; | ||
| 957 | } | ||
| 958 | |||
| 938 | pr_debug("XCOPY: Processed %d target descriptors, length: %u\n", rc, | 959 | pr_debug("XCOPY: Processed %d target descriptors, length: %u\n", rc, |
| 939 | rc * XCOPY_TARGET_DESC_LEN); | 960 | rc * XCOPY_TARGET_DESC_LEN); |
| 940 | seg_desc = &p[16]; | 961 | seg_desc = &p[16]; |
| @@ -957,7 +978,7 @@ out: | |||
| 957 | if (p) | 978 | if (p) |
| 958 | transport_kunmap_data_sg(se_cmd); | 979 | transport_kunmap_data_sg(se_cmd); |
| 959 | kfree(xop); | 980 | kfree(xop); |
| 960 | return TCM_INVALID_CDB_FIELD; | 981 | return ret; |
| 961 | } | 982 | } |
| 962 | 983 | ||
| 963 | static sense_reason_t target_rcr_operating_parameters(struct se_cmd *se_cmd) | 984 | static sense_reason_t target_rcr_operating_parameters(struct se_cmd *se_cmd) |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index ce5221fa393a..e663921eebb6 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
| @@ -1056,7 +1056,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) | |||
| 1056 | if (data_direction != DMA_NONE) { | 1056 | if (data_direction != DMA_NONE) { |
| 1057 | ret = vhost_scsi_map_iov_to_sgl(cmd, | 1057 | ret = vhost_scsi_map_iov_to_sgl(cmd, |
| 1058 | &vq->iov[data_first], data_num, | 1058 | &vq->iov[data_first], data_num, |
| 1059 | data_direction == DMA_TO_DEVICE); | 1059 | data_direction == DMA_FROM_DEVICE); |
| 1060 | if (unlikely(ret)) { | 1060 | if (unlikely(ret)) { |
| 1061 | vq_err(vq, "Failed to map iov to sgl\n"); | 1061 | vq_err(vq, "Failed to map iov to sgl\n"); |
| 1062 | goto err_free; | 1062 | goto err_free; |
