On Tue, 10 Aug 2010 01:32:41 +0100 Pete Batard <pbatard@xxxxxxxxx> wrote: > Not sure if this is related to the issue previously reported by Tomasz. > > Platform: Linux (Slackware 13.0), ARM (Marvell Feroceon), Kernel 2.6.31.3 > > When issuing the following command: > > tgtadm --lld iscsi --mode target --op new --tid 1 --target sheeva:disk1 > > I am observing the following in 1.0.7, as well as with tgtd compiled > from the latest git: > ---------------------------------------------------------------------- > root@sheeva:~# gdb --args tgtd -f -d 4 > GNU gdb 6.8 > Copyright (C) 2008 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. Type "show copying" > and "show warranty" for details. > This GDB was configured as "arm-slackware-linux-gnueabi"... > (gdb) run > Starting program: /usr/sbin/tgtd -f -d 4 > [Thread debugging using libthread_db enabled] > tgtd: bs_init(312) use signalfd notification > tgtd: tgt_mgmt(346) 143 0 1 0 1 0 ffffffffffffffff > targetname=sheeva:disk1 4559 > tgtd: tgt_device_create(445) 1 0 > [New Thread 0x40020350 (LWP 4559)] > > Program received signal SIGSEGV, Segmentation fault. > [Switching to Thread 0x40020350 (LWP 4559)] > 0x400f8b7c in strspn () from /lib/libc.so.6 > ---------------------------------------------------------------------- The above works fine on my x86_64 box with 1.0.7 (and the latest git). Looks like tgtd crashes somewhere in tgt_device_create(). This patch works? diff --git a/usr/target.c b/usr/target.c index bb5b0c8..e006501 100644 --- a/usr/target.c +++ b/usr/target.c @@ -434,7 +434,7 @@ int tgt_device_create(int tid, int dev_type, uint64_t lun, char *params, int backing) { char *p, *path = NULL, *bstype = NULL, *bsoflags = NULL; - int ret = 0, lu_bsoflags; + int ret = 0, lu_bsoflags = 0; struct target *target; struct scsi_lu *lu, *pos; struct device_type_template *t; @@ -497,10 +497,12 @@ int tgt_device_create(int tid, int dev_type, uint64_t lun, char *params, goto out; } - lu_bsoflags = str_to_open_flags(bsoflags); - if (lu_bsoflags == -1) { - ret = TGTADM_INVALID_REQUEST; - goto out; + if (bsoflags) { + lu_bsoflags = str_to_open_flags(bsoflags); + if (lu_bsoflags == -1) { + ret = TGTADM_INVALID_REQUEST; + goto out; + } } if (lu_bsoflags && !(bst->bs_oflags_supported & lu_bsoflags)) { -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html