Blob Blame History Raw
Andy Grover (3):
      tgt-setup-lun: change manpage bugs reporting addr to stgt@vger
      tgt-setup-lun: only delete new target on err when one was created
      tgt-admin: merge duplicate blocks in targets.conf

FUJITA Tomonori (1):
      iscsi: fix buffer overflow before login

Roland Friedwagner (1):
      semaphore key clash with Open-iSCSI initiator and FHS correction for ipc socket

Zdenek Kaspar (1):
      remove README.ibmvstgt entry from doc/Makefile

diff --git a/doc/Makefile b/doc/Makefile
index 3c6fa08..60ae8e9 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -4,7 +4,7 @@ docdir ?= $(PREFIX)/share/doc/tgt
 MANPAGES = manpages/tgtadm.8 manpages/tgt-admin.8 manpages/tgtimg.8 \
 		manpages/tgt-setup-lun.8 manpages/tgtd.8
 
-DOCS = README.fcoe README.ibmvstgt README.iscsi README.iser \
+DOCS = README.fcoe README.iscsi README.iser \
 	    README.lu_configuration README.mmc tmf.txt
 
 XSLTPROC = /usr/bin/xsltproc
diff --git a/doc/manpages/tgt-setup-lun.8 b/doc/manpages/tgt-setup-lun.8
index 2c7c3b0..c1045e8 100644
--- a/doc/manpages/tgt-setup-lun.8
+++ b/doc/manpages/tgt-setup-lun.8
@@ -40,6 +40,7 @@ tgt-setup-lun -h
 .SH AUTHOR
 Written by Erez Zilber
 .SH "REPORTING BUGS"
-Report bugs to <erezz@voltaire.com>.
+.PP
+Report bugs to <stgt@vger\&.kernel\&.org>
 .SH COPYRIGHT
 Copyright \(co Voltaire Ltd. 2008.
diff --git a/scripts/tgt-admin b/scripts/tgt-admin
index 2c69e8b..2ffa8cf 100755
--- a/scripts/tgt-admin
+++ b/scripts/tgt-admin
@@ -162,7 +162,7 @@ sub parse_configs {
 		# Check if alternative configuration file exists
 		if (-e "$alternate_conf") {
 			execute("# Using $alternate_conf as configuration file\n");
-			%conf = ParseConfig(-ConfigFile => "$alternate_conf", -UseApacheInclude => 1, -IncludeGlob => 1,);
+			%conf = ParseConfig(-ConfigFile => "$alternate_conf", -UseApacheInclude => 1, -IncludeGlob => 1, -MergeDuplicateBlocks => 1);
 		}
 		else {
 			die("Config file $alternate_conf not found. Exiting...\n");
@@ -170,7 +170,7 @@ sub parse_configs {
 	} else {
 		# Parse the config file with Config::General
 		if (-e "$configfile") {
-			%conf = ParseConfig(-ConfigFile => "$configfile", -UseApacheInclude => 1, -IncludeGlob => 1,);
+			%conf = ParseConfig(-ConfigFile => "$configfile", -UseApacheInclude => 1, -IncludeGlob => 1, -MergeDuplicateBlocks => 1);
 		} else {
 			die("Config file $configfile not found. Exiting...\n");
 		}
diff --git a/scripts/tgt-setup-lun b/scripts/tgt-setup-lun
index 2685095..9fef7f9 100755
--- a/scripts/tgt-setup-lun
+++ b/scripts/tgt-setup-lun
@@ -120,6 +120,10 @@ find_vacant_lun()
 
 err_exit()
 {
+	if ((new_tgt == 0)); then
+		exit 1
+	fi
+
 	echo "Deleting new target, tid=$tid"
 	tgtadm --lld $lld_name --op delete --mode target --tid $tid
 	res=$?
@@ -196,6 +200,7 @@ if [ $? -eq 1 ]; then
 	fi
 	tid=$(tgtadm --lld $lld_name --op show --mode target | grep $tgt_name | cut -d" " -f2)
 	tid=${tid%:}
+	new_tgt=0
 else
 	find_vacant_tgt_id
 	tid=$?
@@ -209,6 +214,7 @@ else
 		echo "Error: failed to create target (name=$tgt_name, tid=$tid)"
 		exit 1
 	fi
+	new_tgt=1
 fi
 
 find_vacant_lun $tid
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index ff3f32b..e8140e0 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -1987,6 +1987,13 @@ again:
 		conn->req.ahssize = conn->req.bhs.hlength * 4;
 		conn->req.datasize = ntoh24(conn->req.bhs.dlength);
 		conn->rx_size = conn->req.ahssize;
+
+		if (conn->state != STATE_SCSI &&
+		    conn->req.ahssize > INCOMING_BUFSIZE) {
+			conn->state = STATE_CLOSE;
+			return;
+		}
+
 		if (conn->rx_size) {
 			conn->rx_buffer = conn->req.ahs;
 			conn->rx_iostate = IOSTATE_RX_AHS;
@@ -2039,6 +2046,14 @@ again:
 		if (conn->rx_size) {
 			conn->rx_iostate = IOSTATE_RX_DATA;
 			conn->rx_buffer = conn->req.data;
+
+			if (conn->state != STATE_SCSI) {
+				if (conn->req.ahssize + conn->rx_size >
+				    INCOMING_BUFSIZE) {
+					conn->state = STATE_CLOSE;
+					return;
+				}
+			}
 		} else {
 			conn->rx_iostate = IOSTATE_RX_END;
 			break;
diff --git a/usr/log.c b/usr/log.c
index f2c08a6..06cd8bf 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -33,7 +33,7 @@
 
 #include "log.h"
 
-#define SEMKEY	0xA7L
+#define SEMKEY	0x54475444L /* TGTD */
 #define LOGDBG 0
 
 #if LOGDBG
diff --git a/usr/tgtadm.h b/usr/tgtadm.h
index 53a9608..f53baaa 100644
--- a/usr/tgtadm.h
+++ b/usr/tgtadm.h
@@ -1,7 +1,7 @@
 #ifndef TGTADM_H
 #define TGTADM_H
 
-#define TGT_IPC_NAMESPACE	"/tmp/.TGT_IPC_ABSTRACT_NAMESPACE"
+#define TGT_IPC_NAMESPACE	"/var/run/tgtd.ipc_abstract_namespace"
 #define TGT_LLD_NAME_LEN	64
 
 #define GLOBAL_TID (~0U)