diff options
| -rw-r--r-- | drivers/target/iscsi/iscsi_target_auth.c | 5 | ||||
| -rw-r--r-- | drivers/target/target_core_file.h | 2 | ||||
| -rw-r--r-- | drivers/target/target_core_pscsi.c | 11 | ||||
| -rw-r--r-- | drivers/target/target_core_sbc.c | 7 | ||||
| -rw-r--r-- | drivers/target/target_core_tpg.c | 3 | ||||
| -rw-r--r-- | drivers/vhost/tcm_vhost.c | 13 |
6 files changed, 29 insertions, 12 deletions
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index db0cf7c8adde..a0fc7b9eea65 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
| @@ -166,6 +166,7 @@ static int chap_server_compute_md5( | |||
| 166 | { | 166 | { |
| 167 | char *endptr; | 167 | char *endptr; |
| 168 | unsigned long id; | 168 | unsigned long id; |
| 169 | unsigned char id_as_uchar; | ||
| 169 | unsigned char digest[MD5_SIGNATURE_SIZE]; | 170 | unsigned char digest[MD5_SIGNATURE_SIZE]; |
| 170 | unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; | 171 | unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; |
| 171 | unsigned char identifier[10], *challenge = NULL; | 172 | unsigned char identifier[10], *challenge = NULL; |
| @@ -355,7 +356,9 @@ static int chap_server_compute_md5( | |||
| 355 | goto out; | 356 | goto out; |
| 356 | } | 357 | } |
| 357 | 358 | ||
| 358 | sg_init_one(&sg, &id, 1); | 359 | /* To handle both endiannesses */ |
| 360 | id_as_uchar = id; | ||
| 361 | sg_init_one(&sg, &id_as_uchar, 1); | ||
| 359 | ret = crypto_hash_update(&desc, &sg, 1); | 362 | ret = crypto_hash_update(&desc, &sg, 1); |
| 360 | if (ret < 0) { | 363 | if (ret < 0) { |
| 361 | pr_err("crypto_hash_update() failed for id\n"); | 364 | pr_err("crypto_hash_update() failed for id\n"); |
diff --git a/drivers/target/target_core_file.h b/drivers/target/target_core_file.h index bc02b018ae46..37ffc5bd2399 100644 --- a/drivers/target/target_core_file.h +++ b/drivers/target/target_core_file.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #define FD_DEVICE_QUEUE_DEPTH 32 | 7 | #define FD_DEVICE_QUEUE_DEPTH 32 |
| 8 | #define FD_MAX_DEVICE_QUEUE_DEPTH 128 | 8 | #define FD_MAX_DEVICE_QUEUE_DEPTH 128 |
| 9 | #define FD_BLOCKSIZE 512 | 9 | #define FD_BLOCKSIZE 512 |
| 10 | #define FD_MAX_SECTORS 1024 | 10 | #define FD_MAX_SECTORS 2048 |
| 11 | 11 | ||
| 12 | #define RRF_EMULATE_CDB 0x01 | 12 | #define RRF_EMULATE_CDB 0x01 |
| 13 | #define RRF_GOT_LBA 0x02 | 13 | #define RRF_GOT_LBA 0x02 |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 82e78d72fdb6..e992b27aa090 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
| @@ -883,7 +883,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
| 883 | pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i, | 883 | pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i, |
| 884 | page, len, off); | 884 | page, len, off); |
| 885 | 885 | ||
| 886 | while (len > 0 && data_len > 0) { | 886 | /* |
| 887 | * We only have one page of data in each sg element, | ||
| 888 | * we can not cross a page boundary. | ||
| 889 | */ | ||
| 890 | if (off + len > PAGE_SIZE) | ||
| 891 | goto fail; | ||
| 892 | |||
| 893 | if (len > 0 && data_len > 0) { | ||
| 887 | bytes = min_t(unsigned int, len, PAGE_SIZE - off); | 894 | bytes = min_t(unsigned int, len, PAGE_SIZE - off); |
| 888 | bytes = min(bytes, data_len); | 895 | bytes = min(bytes, data_len); |
| 889 | 896 | ||
| @@ -940,9 +947,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, | |||
| 940 | bio = NULL; | 947 | bio = NULL; |
| 941 | } | 948 | } |
| 942 | 949 | ||
| 943 | len -= bytes; | ||
| 944 | data_len -= bytes; | 950 | data_len -= bytes; |
| 945 | off = 0; | ||
| 946 | } | 951 | } |
| 947 | } | 952 | } |
| 948 | 953 | ||
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 290230de2c53..60d4b5185f32 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
| @@ -464,8 +464,11 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) | |||
| 464 | break; | 464 | break; |
| 465 | case SYNCHRONIZE_CACHE: | 465 | case SYNCHRONIZE_CACHE: |
| 466 | case SYNCHRONIZE_CACHE_16: | 466 | case SYNCHRONIZE_CACHE_16: |
| 467 | if (!ops->execute_sync_cache) | 467 | if (!ops->execute_sync_cache) { |
| 468 | return TCM_UNSUPPORTED_SCSI_OPCODE; | 468 | size = 0; |
| 469 | cmd->execute_cmd = sbc_emulate_noop; | ||
| 470 | break; | ||
| 471 | } | ||
| 469 | 472 | ||
| 470 | /* | 473 | /* |
| 471 | * Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE | 474 | * Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE |
diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c index 9169d6a5d7e4..aac9d2727e3c 100644 --- a/drivers/target/target_core_tpg.c +++ b/drivers/target/target_core_tpg.c | |||
| @@ -711,7 +711,8 @@ int core_tpg_register( | |||
| 711 | 711 | ||
| 712 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) { | 712 | if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) { |
| 713 | if (core_tpg_setup_virtual_lun0(se_tpg) < 0) { | 713 | if (core_tpg_setup_virtual_lun0(se_tpg) < 0) { |
| 714 | kfree(se_tpg); | 714 | array_free(se_tpg->tpg_lun_list, |
| 715 | TRANSPORT_MAX_LUNS_PER_TPG); | ||
| 715 | return -ENOMEM; | 716 | return -ENOMEM; |
| 716 | } | 717 | } |
| 717 | } | 718 | } |
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index 9951297b2427..43fb11ee2e8d 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c | |||
| @@ -850,7 +850,7 @@ static int vhost_scsi_clear_endpoint( | |||
| 850 | for (index = 0; index < vs->dev.nvqs; ++index) { | 850 | for (index = 0; index < vs->dev.nvqs; ++index) { |
| 851 | if (!vhost_vq_access_ok(&vs->vqs[index])) { | 851 | if (!vhost_vq_access_ok(&vs->vqs[index])) { |
| 852 | ret = -EFAULT; | 852 | ret = -EFAULT; |
| 853 | goto err; | 853 | goto err_dev; |
| 854 | } | 854 | } |
| 855 | } | 855 | } |
| 856 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { | 856 | for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) { |
| @@ -860,10 +860,11 @@ static int vhost_scsi_clear_endpoint( | |||
| 860 | if (!tv_tpg) | 860 | if (!tv_tpg) |
| 861 | continue; | 861 | continue; |
| 862 | 862 | ||
| 863 | mutex_lock(&tv_tpg->tv_tpg_mutex); | ||
| 863 | tv_tport = tv_tpg->tport; | 864 | tv_tport = tv_tpg->tport; |
| 864 | if (!tv_tport) { | 865 | if (!tv_tport) { |
| 865 | ret = -ENODEV; | 866 | ret = -ENODEV; |
| 866 | goto err; | 867 | goto err_tpg; |
| 867 | } | 868 | } |
| 868 | 869 | ||
| 869 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { | 870 | if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) { |
| @@ -872,16 +873,19 @@ static int vhost_scsi_clear_endpoint( | |||
| 872 | tv_tport->tport_name, tv_tpg->tport_tpgt, | 873 | tv_tport->tport_name, tv_tpg->tport_tpgt, |
| 873 | t->vhost_wwpn, t->vhost_tpgt); | 874 | t->vhost_wwpn, t->vhost_tpgt); |
| 874 | ret = -EINVAL; | 875 | ret = -EINVAL; |
| 875 | goto err; | 876 | goto err_tpg; |
| 876 | } | 877 | } |
| 877 | tv_tpg->tv_tpg_vhost_count--; | 878 | tv_tpg->tv_tpg_vhost_count--; |
| 878 | vs->vs_tpg[target] = NULL; | 879 | vs->vs_tpg[target] = NULL; |
| 879 | vs->vs_endpoint = false; | 880 | vs->vs_endpoint = false; |
| 881 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
| 880 | } | 882 | } |
| 881 | mutex_unlock(&vs->dev.mutex); | 883 | mutex_unlock(&vs->dev.mutex); |
| 882 | return 0; | 884 | return 0; |
| 883 | 885 | ||
| 884 | err: | 886 | err_tpg: |
| 887 | mutex_unlock(&tv_tpg->tv_tpg_mutex); | ||
| 888 | err_dev: | ||
| 885 | mutex_unlock(&vs->dev.mutex); | 889 | mutex_unlock(&vs->dev.mutex); |
| 886 | return ret; | 890 | return ret; |
| 887 | } | 891 | } |
| @@ -937,6 +941,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs) | |||
| 937 | 941 | ||
| 938 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) | 942 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) |
| 939 | vhost_scsi_flush_vq(vs, i); | 943 | vhost_scsi_flush_vq(vs, i); |
| 944 | vhost_work_flush(&vs->dev, &vs->vs_completion_work); | ||
| 940 | } | 945 | } |
| 941 | 946 | ||
| 942 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) | 947 | static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) |
