History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending

Pull SCSI target fixes from Nicholas Bellinger: "These are mostly minor fixes this time around. The iscsi-target CHAP big-endian bugfix and bump FD_MAX_SECTORS=2048 default patch to allow 1MB sized I/Os for FILEIO backends on >= v3.5 code are both CC'ed to stable. Also, there is a persistent reservations regression that has recently been reported for >= v3.8.x code, that is currently being tracked down for v3.9." * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: target/pscsi: Reject cross page boundary case in pscsi_map_sg target/file: Bump FD_MAX_SECTORS to 2048 to handle 1M sized I/Os tcm_vhost: Flush vhost_work in vhost_scsi_flush() tcm_vhost: Add missed lock in vhost_scsi_clear_endpoint() target: fix possible memory leak in core_tpg_register() target/iscsi: Fix mutual CHAP auth on big-endian arches target_core_sbc: use noop for SYNCHRONIZE_CACHE

Linus Torvalds committed 13 years ago

Commit a607a112 parents 22c3f2f 8f27d486 files · +29 −12Browse files

Unified · Split

6 files
  1. drivers/target/iscsi/iscsi_target_auth.c +4 −1
  2. drivers/target/target_core_file.h +1 −1
  3. drivers/target/target_core_pscsi.c +8 −3
  4. drivers/target/target_core_sbc.c +5 −2
  5. drivers/target/target_core_tpg.c +2 −1
  6. drivers/vhost/tcm_vhost.c +9 −4
drivers/target/iscsi/iscsi_target_auth.c+4−1
@@ -166,6 +166,7 @@ static int chap_server_compute_md5( · 165 unmodified lines
166166 {
167167 char *endptr;
168168 unsigned long id;
169+ unsigned char id_as_uchar;
169170 unsigned char digest[MD5_SIGNATURE_SIZE];
170171 unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2];
171172 unsigned char identifier[10], *challenge = NULL;
@@ -355,7 +356,9 @@ static int chap_server_compute_md5( · 183 unmodified lines
355356 goto out;
356357 }
357358
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);
359362 ret = crypto_hash_update(&desc, &sg, 1);
360363 if (ret < 0) {
361364 pr_err("crypto_hash_update() failed for id\n");
drivers/target/target_core_file.h+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 #define FD_DEVICE_QUEUE_DEPTH 32
88 #define FD_MAX_DEVICE_QUEUE_DEPTH 128
99 #define FD_BLOCKSIZE 512
10−#define FD_MAX_SECTORS 1024
10+#define FD_MAX_SECTORS 2048
1111
1212 #define RRF_EMULATE_CDB 0x01
1313 #define RRF_GOT_LBA 0x02
drivers/target/target_core_pscsi.c+8−3
@@ -883,7 +883,14 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, · 882 unmodified lines
883883 pr_debug("PSCSI: i: %d page: %p len: %d off: %d\n", i,
884884 page, len, off);
885885
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) {
887894 bytes = min_t(unsigned int, len, PAGE_SIZE - off);
888895 bytes = min(bytes, data_len);
889896
@@ -940,9 +947,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents, · 50 unmodified lines
940947 bio = NULL;
941948 }
942949
943− len -= bytes;
944950 data_len -= bytes;
945− off = 0;
946951 }
947952 }
948953
drivers/target/target_core_sbc.c+5−2
@@ -464,8 +464,11 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) · 463 unmodified lines
464464 break;
465465 case SYNCHRONIZE_CACHE:
466466 case SYNCHRONIZE_CACHE_16:
467− if (!ops->execute_sync_cache)
468− return TCM_UNSUPPORTED_SCSI_OPCODE;
467+ if (!ops->execute_sync_cache) {
468+ size = 0;
469+ cmd->execute_cmd = sbc_emulate_noop;
470+ break;
471+ }
469472
470473 /*
471474 * Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE
drivers/target/target_core_tpg.c+2−1
@@ -711,7 +711,8 @@ int core_tpg_register( · 710 unmodified lines
711711
712712 if (se_tpg->se_tpg_type == TRANSPORT_TPG_TYPE_NORMAL) {
713713 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);
715716 return -ENOMEM;
716717 }
717718 }
drivers/vhost/tcm_vhost.c+9−4
@@ -850,7 +850,7 @@ static int vhost_scsi_clear_endpoint( · 849 unmodified lines
850850 for (index = 0; index < vs->dev.nvqs; ++index) {
851851 if (!vhost_vq_access_ok(&vs->vqs[index])) {
852852 ret = -EFAULT;
853− goto err;
853+ goto err_dev;
854854 }
855855 }
856856 for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) {
@@ -860,10 +860,11 @@ static int vhost_scsi_clear_endpoint( · 3 unmodified lines
860860 if (!tv_tpg)
861861 continue;
862862
863+ mutex_lock(&tv_tpg->tv_tpg_mutex);
863864 tv_tport = tv_tpg->tport;
864865 if (!tv_tport) {
865866 ret = -ENODEV;
866− goto err;
867+ goto err_tpg;
867868 }
868869
869870 if (strcmp(tv_tport->tport_name, t->vhost_wwpn)) {
@@ -872,16 +873,19 @@ static int vhost_scsi_clear_endpoint( · 2 unmodified lines
872873 tv_tport->tport_name, tv_tpg->tport_tpgt,
873874 t->vhost_wwpn, t->vhost_tpgt);
874875 ret = -EINVAL;
875− goto err;
876+ goto err_tpg;
876877 }
877878 tv_tpg->tv_tpg_vhost_count--;
878879 vs->vs_tpg[target] = NULL;
879880 vs->vs_endpoint = false;
881+ mutex_unlock(&tv_tpg->tv_tpg_mutex);
880882 }
881883 mutex_unlock(&vs->dev.mutex);
882884 return 0;
883885
884−err:
886+err_tpg:
887+ mutex_unlock(&tv_tpg->tv_tpg_mutex);
888+err_dev:
885889 mutex_unlock(&vs->dev.mutex);
886890 return ret;
887891 }
@@ -937,6 +941,7 @@ static void vhost_scsi_flush(struct vhost_scsi *vs) · 49 unmodified lines
937941
938942 for (i = 0; i < VHOST_SCSI_MAX_VQ; i++)
939943 vhost_scsi_flush_vq(vs, i);
944+ vhost_work_flush(&vs->dev, &vs->vs_completion_work);
940945 }
941946
942947 static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t