<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/target, branch v3.0.9</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>tcm_loop: Add explict read buffer memset for SCF_SCSI_CONTROL_SG_IO_CDB</title>
<updated>2011-11-11T17:37:01+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2011-10-24T20:35:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=fef547148349098f58bcea1c6cda5be1f6f8719c'/>
<id>fef547148349098f58bcea1c6cda5be1f6f8719c</id>
<content type='text'>
commit 8cd79f24350826b81e16990d9e12bc878e67d385 upstream.

This patch addresses an issue with buggy userspace code sending I/O
via scsi-generic that does not explictly clear their associated read
buffers.  It adds an explict memset of the first SGL entry within
tcm_loop_new_cmd_map() for SCF_SCSI_CONTROL_SG_IO_CDB payloads that
are currently guaranteed to be a single SGL by target-core code.

This issue is a side effect of the v3.1-rc1 merge to remove the
extra memcpy between certain control CDB types using a contigious
+ cleared buffer in target-core, and performing a memcpy into the
SGL list within tcm_loop.

It was originally mainfesting itself by udev + scsi_id + scsi-generic
not properly setting up the expected /dev/disk/by-id/ symlinks because
the INQUIRY payload was containing extra bogus data preventing the
proper NAA IEEE WWN from being parsed by userspace.

Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 8cd79f24350826b81e16990d9e12bc878e67d385 upstream.

This patch addresses an issue with buggy userspace code sending I/O
via scsi-generic that does not explictly clear their associated read
buffers.  It adds an explict memset of the first SGL entry within
tcm_loop_new_cmd_map() for SCF_SCSI_CONTROL_SG_IO_CDB payloads that
are currently guaranteed to be a single SGL by target-core code.

This issue is a side effect of the v3.1-rc1 merge to remove the
extra memcpy between certain control CDB types using a contigious
+ cleared buffer in target-core, and performing a memcpy into the
SGL list within tcm_loop.

It was originally mainfesting itself by udev + scsi_id + scsi-generic
not properly setting up the expected /dev/disk/by-id/ symlinks because
the INQUIRY payload was containing extra bogus data preventing the
proper NAA IEEE WWN from being parsed by userspace.

Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>target: Fix REPORT TARGET PORT GROUPS handling with small allocation length</title>
<updated>2011-11-11T17:35:26+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2011-10-19T06:48:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f2c1c3233aa7b1742c458b1eed929d675222e70c'/>
<id>f2c1c3233aa7b1742c458b1eed929d675222e70c</id>
<content type='text'>
commit 6b20fa9aaf0c2f69ee6f9648e20ab2be0206705e upstream.

This patch fixes a bug with the handling of REPORT TARGET PORT GROUPS
containing a smaller allocation length than the payload requires causing
memory writes beyond the end of the buffer.  This patch checks for the
minimum 4 byte length for the response payload length, and also checks
upon each loop of T10_ALUA(su_dev)-&gt;tg_pt_gps_list to ensure the Target
port group and Target port descriptor list is able to fit into the
remaining allocation length.

If the response payload exceeds the allocation length length, then rd_len
is still increments to indicate to the initiator that the payload has
been truncated.

Reported-by: Roland Dreier &lt;roland@purestorage.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@risingtidesystems.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 6b20fa9aaf0c2f69ee6f9648e20ab2be0206705e upstream.

This patch fixes a bug with the handling of REPORT TARGET PORT GROUPS
containing a smaller allocation length than the payload requires causing
memory writes beyond the end of the buffer.  This patch checks for the
minimum 4 byte length for the response payload length, and also checks
upon each loop of T10_ALUA(su_dev)-&gt;tg_pt_gps_list to ensure the Target
port group and Target port descriptor list is able to fit into the
remaining allocation length.

If the response payload exceeds the allocation length length, then rd_len
is still increments to indicate to the initiator that the payload has
been truncated.

Reported-by: Roland Dreier &lt;roland@purestorage.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@risingtidesystems.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>tcm_fc: Fix conversion spec warning</title>
<updated>2011-06-24T00:09:16+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2011-06-23T23:28:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=95efa2863996b643083957079b9304fb3c01130f'/>
<id>95efa2863996b643083957079b9304fb3c01130f</id>
<content type='text'>
This patch fixes the following conversion specification warning for size_t

drivers/target/tcm_fc/tfc_io.c: In function ‘ft_queue_data_in’:
drivers/target/tcm_fc/tfc_io.c:209: warning: format ‘%x’ expects type ‘unsigned int’, but argument 5 has type ‘size_t’

Reported-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes the following conversion specification warning for size_t

drivers/target/tcm_fc/tfc_io.c: In function ‘ft_queue_data_in’:
drivers/target/tcm_fc/tfc_io.c:209: warning: format ‘%x’ expects type ‘unsigned int’, but argument 5 has type ‘size_t’

Reported-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tcm_fc: Fix possible lock to unlock type deadlock</title>
<updated>2011-06-24T00:09:15+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>error27@gmail.com</email>
</author>
<published>2011-06-13T20:08:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7c7cf3b9c31ed09822e5c186297991093ee13c49'/>
<id>7c7cf3b9c31ed09822e5c186297991093ee13c49</id>
<content type='text'>
There is a typo here, it should be an unlock instead of a lock.  The
original code will deadlock.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is a typo here, it should be an unlock instead of a lock.  The
original code will deadlock.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tcm_fc: Fix ft_send_tm LUN lookup OOPs</title>
<updated>2011-06-24T00:09:15+00:00</updated>
<author>
<name>Kiran Patil</name>
<email>kiran.patil@intel.com</email>
</author>
<published>2011-06-22T23:30:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=61db952713a8bc1b18515db3f2eac354ec8990bd'/>
<id>61db952713a8bc1b18515db3f2eac354ec8990bd</id>
<content type='text'>
This patch fixes a bug in ft_send_tm() that was incorrectly calling
ft_get_lun_for_cmd() -&gt; transport_get_lun_for_cmd(), instead of using
transport_get_lun_for_tmr() for the proper struct se_lun lookup
that was triggering an OOPs in the se_cmd-&gt;tmr_req failure path.

This patch fixes the issue by re-arranging the codepath where
transport_get_lun_for_tmr() is called after tmr request is allocated and
made it available as part of se_cmd.

It also drops the now unnecessary ft_get_lun_for_cmd() unpacking code, and
uses scsilun_to_int() directly ahead of transport_get_lun_for_cmd() and
transport_get_lun_for_tmr() usage.

Signed-off-by: Patil, Kiran &lt;kiran.patil@intel.com&gt;
Signed-off-by: Robert Love &lt;robert.w.love@intel.com&gt;
Signed-off-by: Nicholas A. Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes a bug in ft_send_tm() that was incorrectly calling
ft_get_lun_for_cmd() -&gt; transport_get_lun_for_cmd(), instead of using
transport_get_lun_for_tmr() for the proper struct se_lun lookup
that was triggering an OOPs in the se_cmd-&gt;tmr_req failure path.

This patch fixes the issue by re-arranging the codepath where
transport_get_lun_for_tmr() is called after tmr request is allocated and
made it available as part of se_cmd.

It also drops the now unnecessary ft_get_lun_for_cmd() unpacking code, and
uses scsilun_to_int() directly ahead of transport_get_lun_for_cmd() and
transport_get_lun_for_tmr() usage.

Signed-off-by: Patil, Kiran &lt;kiran.patil@intel.com&gt;
Signed-off-by: Robert Love &lt;robert.w.love@intel.com&gt;
Signed-off-by: Nicholas A. Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target: Fix incorrect strlen() NULL terminator checks</title>
<updated>2011-06-24T00:08:11+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>error27@gmail.com</email>
</author>
<published>2011-06-15T17:03:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=60d645a4e9e7e7ddc20e534fea82aa4e6947f911'/>
<id>60d645a4e9e7e7ddc20e534fea82aa4e6947f911</id>
<content type='text'>
This patch fixes a number of cases in target core using an incorrectly

	if (strlen(foo) &gt; SOME_MAX_SIZE)

As strlen() returns the number of characters in the string not counting
the NULL character at the end.  So if you do something like:

        char buf[10];

        if (strlen("0123456789") &gt; 10)
                return -ETOOLONG;
        snprintf(buf, 10, "0123456789");
        printf("%s\n", buf);

then the last "9" gets chopped off and only "012345678" is printed.

Plus I threw in one small related cleanup.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes a number of cases in target core using an incorrectly

	if (strlen(foo) &gt; SOME_MAX_SIZE)

As strlen() returns the number of characters in the string not counting
the NULL character at the end.  So if you do something like:

        char buf[10];

        if (strlen("0123456789") &gt; 10)
                return -ETOOLONG;
        snprintf(buf, 10, "0123456789");
        printf("%s\n", buf);

then the last "9" gets chopped off and only "012345678" is printed.

Plus I threw in one small related cleanup.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target: Drop bogus ERR_PTR usage in target_fabric_configfs_init</title>
<updated>2011-06-24T00:03:51+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>error27@gmail.com</email>
</author>
<published>2011-06-13T20:10:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5eff5be0b1993f4291f2b8c6d035b408010f96c5'/>
<id>5eff5be0b1993f4291f2b8c6d035b408010f96c5</id>
<content type='text'>
In the original code, there were several places inside the
target_fabric_configfs_init() function that returned NULL on error
and one place the returned an ERR_PTR.  There are two places that
call this function and they only check for NULL returns; they don't
check for ERR_PTRs.  So I've changed the ERR_PTR so now the function
only returns NULL on error.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the original code, there were several places inside the
target_fabric_configfs_init() function that returned NULL on error
and one place the returned an ERR_PTR.  There are two places that
call this function and they only check for NULL returns; they don't
check for ERR_PTRs.  So I've changed the ERR_PTR so now the function
only returns NULL on error.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target: Fix ERR_PTR dereferencing bugs</title>
<updated>2011-06-24T00:03:27+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>error27@gmail.com</email>
</author>
<published>2011-06-15T16:41:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=552523dcbf0f33d44d816da310be8227a2c1502a'/>
<id>552523dcbf0f33d44d816da310be8227a2c1502a</id>
<content type='text'>
transport_init_session() and core_tmr_alloc_req() never return NULL,
they only return ERR_PTRs on error.

v2: Fix patch to return PTR_ERR(tl_nexus-&gt;se_sess) from Ankit Jain's
feedback.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Ankit Jain &lt;jankit@suse.de&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
transport_init_session() and core_tmr_alloc_req() never return NULL,
they only return ERR_PTRs on error.

v2: Fix patch to return PTR_ERR(tl_nexus-&gt;se_sess) from Ankit Jain's
feedback.

Signed-off-by: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Ankit Jain &lt;jankit@suse.de&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target: Convert transport_deregister_session_configfs nacl_sess_lock to save irq state</title>
<updated>2011-06-23T23:59:45+00:00</updated>
<author>
<name>Roland Dreier</name>
<email>roland@purestorage.com</email>
</author>
<published>2011-06-22T08:02:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=233888644d80cc44330062e5e978c9e3a14c9cb9'/>
<id>233888644d80cc44330062e5e978c9e3a14c9cb9</id>
<content type='text'>
This patch converts transport_deregister_session_configfs() to save/restore
spinlock IRQ state for struct se_node_acl-&gt;nacl_sess_lock access as tcm_qla2xxx
logic expects to call transport_deregister_session_configfs() code with
irq save already held for struct qla_hw_data.

Reported-by: Roland Dreier &lt;roland@purestorage.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch converts transport_deregister_session_configfs() to save/restore
spinlock IRQ state for struct se_node_acl-&gt;nacl_sess_lock access as tcm_qla2xxx
logic expects to call transport_deregister_session_configfs() code with
irq save already held for struct qla_hw_data.

Reported-by: Roland Dreier &lt;roland@purestorage.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>target: Fix transport_get_lun_for_tmr failure cases</title>
<updated>2011-06-23T23:59:45+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2011-06-23T23:48:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7fd29aa920273b70be50c14c4b7e2213fb6623ce'/>
<id>7fd29aa920273b70be50c14c4b7e2213fb6623ce</id>
<content type='text'>
This patch fixes two possible NULL pointer dereferences in target v4.0
code where se_tmr release path in core_tmr_release_req() can OOPs upon
transport_get_lun_for_tmr() failure by attempting to access se_device or
se_tmr-&gt;tmr_list without a valid member of se_device-&gt;tmr_list during
transport_free_se_cmd() release.  This patch moves the se_tmr-&gt;tmr_dev
pointer assignment in transport_get_lun_for_tmr() until after possible
-ENODEV failures during unpacked_lun lookup.

This addresses an OOPs originally reported with LIO v4.1 upstream on
.39 code here:

    TARGET_CORE[qla2xxx]: Detected NON_EXISTENT_LUN Access for 0x00000000
    BUG: unable to handle kernel NULL pointer dereference at 0000000000000550
    IP: [&lt;ffffffff81035ec4&gt;] __ticket_spin_trylock+0x4/0x20
    PGD 0
    Oops: 0000 [#1] SMP
    last sysfs file: /sys/devices/system/cpu/cpu23/cache/index2/shared_cpu_map
    CPU 1
    Modules linked in: netconsole target_core_pscsi target_core_file
tcm_qla2xxx target_core_iblock tcm_loop target_core_mod configfs
ipmi_devintf ipmi_si ipmi_msghandler serio_raw i7core_edac ioatdma dca
edac_core ps_bdrv ses enclosure usbhid usb_storage ahci qla2xxx hid
uas e1000e mpt2sas libahci mlx4_core scsi_transport_fc
scsi_transport_sas raid_class scsi_tgt [last unloaded: netconsole]

    Pid: 0, comm: kworker/0:0 Tainted: G        W   2.6.39+ #1 Xyratex Storage Server
    RIP: 0010:[&lt;ffffffff81035ec4&gt;] [&lt;ffffffff81035ec4&gt;]__ticket_spin_trylock+0x4/0x20
    RSP: 0018:ffff88063e803c08  EFLAGS: 00010286
    RAX: ffff880619ab45e0 RBX: 0000000000000550 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000550
    RBP: ffff88063e803c08 R08: 0000000000000002 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000568
    R13: 0000000000000001 R14: 0000000000000000 R15: ffff88060cd96a20
    FS:  0000000000000000(0000) GS:ffff88063e800000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: 0000000000000550 CR3: 0000000001a03000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process kworker/0:0 (pid: 0, threadinfo ffff880619ab8000, task ffff880619ab45e0)
    Stack:
     ffff88063e803c28 ffffffff812cf039 0000000000000550 0000000000000568
     ffff88063e803c58 ffffffff8157071e ffffffffa028a1dc ffff88060f7e4600
     0000000000000550 ffff880616961480 ffff88063e803c78 ffffffffa028a1dc
    Call Trace:
&lt;IRQ&gt;
     [&lt;ffffffff812cf039&gt;] do_raw_spin_trylock+0x19/0x50
     [&lt;ffffffff8157071e&gt;] _raw_spin_lock+0x3e/0x70
     [&lt;ffffffffa028a1dc&gt;] ? core_tmr_release_req+0x2c/0x60 [target_core_mod]
     [&lt;ffffffffa028a1dc&gt;] core_tmr_release_req+0x2c/0x60 [target_core_mod]
     [&lt;ffffffffa028d0d2&gt;] transport_free_se_cmd+0x22/0x50 [target_core_mod]
     [&lt;ffffffffa028d120&gt;] transport_release_cmd_to_pool+0x20/0x40 [target_core_mod]
     [&lt;ffffffffa028e525&gt;] transport_generic_free_cmd+0xa5/0xb0 [target_core_mod]
     [&lt;ffffffffa0147cc4&gt;] tcm_qla2xxx_handle_tmr+0xc4/0xd0 [tcm_qla2xxx]
     [&lt;ffffffffa0191ba3&gt;] __qla24xx_handle_abts+0xd3/0x150 [qla2xxx]
     [&lt;ffffffffa0197651&gt;] qla_tgt_response_pkt+0x171/0x520 [qla2xxx]
     [&lt;ffffffffa0197a2d&gt;] qla_tgt_response_pkt_all_vps+0x2d/0x220 [qla2xxx]
     [&lt;ffffffffa0171dd3&gt;] qla24xx_process_response_queue+0x1a3/0x670 [qla2xxx]
     [&lt;ffffffffa0196281&gt;] ? qla24xx_atio_pkt+0x81/0x120 [qla2xxx]
     [&lt;ffffffffa0174025&gt;] ? qla24xx_msix_default+0x45/0x2a0 [qla2xxx]
     [&lt;ffffffffa0174198&gt;] qla24xx_msix_default+0x1b8/0x2a0 [qla2xxx]
     [&lt;ffffffff810dadb4&gt;] handle_irq_event_percpu+0x54/0x210
     [&lt;ffffffff810dafb8&gt;] handle_irq_event+0x48/0x70
     [&lt;ffffffff810dd5ee&gt;] ? handle_edge_irq+0x1e/0x110
     [&lt;ffffffff810dd647&gt;] handle_edge_irq+0x77/0x110
     [&lt;ffffffff8100d362&gt;] handle_irq+0x22/0x40
     [&lt;ffffffff8157b28d&gt;] do_IRQ+0x5d/0xe0
     [&lt;ffffffff81571413&gt;] common_interrupt+0x13/0x13
&lt;EOI&gt;
     [&lt;ffffffff813003f7&gt;] ? intel_idle+0xd7/0x130
     [&lt;ffffffff813003f0&gt;] ? intel_idle+0xd0/0x130
     [&lt;ffffffff8144832b&gt;] cpuidle_idle_call+0xab/0x1c0
     [&lt;ffffffff8100a26b&gt;] cpu_idle+0xab/0xf0
     [&lt;ffffffff81566c59&gt;] start_secondary+0x1cb/0x1d2

Reported-by: Roland Dreier &lt;roland@purestorage.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes two possible NULL pointer dereferences in target v4.0
code where se_tmr release path in core_tmr_release_req() can OOPs upon
transport_get_lun_for_tmr() failure by attempting to access se_device or
se_tmr-&gt;tmr_list without a valid member of se_device-&gt;tmr_list during
transport_free_se_cmd() release.  This patch moves the se_tmr-&gt;tmr_dev
pointer assignment in transport_get_lun_for_tmr() until after possible
-ENODEV failures during unpacked_lun lookup.

This addresses an OOPs originally reported with LIO v4.1 upstream on
.39 code here:

    TARGET_CORE[qla2xxx]: Detected NON_EXISTENT_LUN Access for 0x00000000
    BUG: unable to handle kernel NULL pointer dereference at 0000000000000550
    IP: [&lt;ffffffff81035ec4&gt;] __ticket_spin_trylock+0x4/0x20
    PGD 0
    Oops: 0000 [#1] SMP
    last sysfs file: /sys/devices/system/cpu/cpu23/cache/index2/shared_cpu_map
    CPU 1
    Modules linked in: netconsole target_core_pscsi target_core_file
tcm_qla2xxx target_core_iblock tcm_loop target_core_mod configfs
ipmi_devintf ipmi_si ipmi_msghandler serio_raw i7core_edac ioatdma dca
edac_core ps_bdrv ses enclosure usbhid usb_storage ahci qla2xxx hid
uas e1000e mpt2sas libahci mlx4_core scsi_transport_fc
scsi_transport_sas raid_class scsi_tgt [last unloaded: netconsole]

    Pid: 0, comm: kworker/0:0 Tainted: G        W   2.6.39+ #1 Xyratex Storage Server
    RIP: 0010:[&lt;ffffffff81035ec4&gt;] [&lt;ffffffff81035ec4&gt;]__ticket_spin_trylock+0x4/0x20
    RSP: 0018:ffff88063e803c08  EFLAGS: 00010286
    RAX: ffff880619ab45e0 RBX: 0000000000000550 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000550
    RBP: ffff88063e803c08 R08: 0000000000000002 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000568
    R13: 0000000000000001 R14: 0000000000000000 R15: ffff88060cd96a20
    FS:  0000000000000000(0000) GS:ffff88063e800000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: 0000000000000550 CR3: 0000000001a03000 CR4: 00000000000006e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process kworker/0:0 (pid: 0, threadinfo ffff880619ab8000, task ffff880619ab45e0)
    Stack:
     ffff88063e803c28 ffffffff812cf039 0000000000000550 0000000000000568
     ffff88063e803c58 ffffffff8157071e ffffffffa028a1dc ffff88060f7e4600
     0000000000000550 ffff880616961480 ffff88063e803c78 ffffffffa028a1dc
    Call Trace:
&lt;IRQ&gt;
     [&lt;ffffffff812cf039&gt;] do_raw_spin_trylock+0x19/0x50
     [&lt;ffffffff8157071e&gt;] _raw_spin_lock+0x3e/0x70
     [&lt;ffffffffa028a1dc&gt;] ? core_tmr_release_req+0x2c/0x60 [target_core_mod]
     [&lt;ffffffffa028a1dc&gt;] core_tmr_release_req+0x2c/0x60 [target_core_mod]
     [&lt;ffffffffa028d0d2&gt;] transport_free_se_cmd+0x22/0x50 [target_core_mod]
     [&lt;ffffffffa028d120&gt;] transport_release_cmd_to_pool+0x20/0x40 [target_core_mod]
     [&lt;ffffffffa028e525&gt;] transport_generic_free_cmd+0xa5/0xb0 [target_core_mod]
     [&lt;ffffffffa0147cc4&gt;] tcm_qla2xxx_handle_tmr+0xc4/0xd0 [tcm_qla2xxx]
     [&lt;ffffffffa0191ba3&gt;] __qla24xx_handle_abts+0xd3/0x150 [qla2xxx]
     [&lt;ffffffffa0197651&gt;] qla_tgt_response_pkt+0x171/0x520 [qla2xxx]
     [&lt;ffffffffa0197a2d&gt;] qla_tgt_response_pkt_all_vps+0x2d/0x220 [qla2xxx]
     [&lt;ffffffffa0171dd3&gt;] qla24xx_process_response_queue+0x1a3/0x670 [qla2xxx]
     [&lt;ffffffffa0196281&gt;] ? qla24xx_atio_pkt+0x81/0x120 [qla2xxx]
     [&lt;ffffffffa0174025&gt;] ? qla24xx_msix_default+0x45/0x2a0 [qla2xxx]
     [&lt;ffffffffa0174198&gt;] qla24xx_msix_default+0x1b8/0x2a0 [qla2xxx]
     [&lt;ffffffff810dadb4&gt;] handle_irq_event_percpu+0x54/0x210
     [&lt;ffffffff810dafb8&gt;] handle_irq_event+0x48/0x70
     [&lt;ffffffff810dd5ee&gt;] ? handle_edge_irq+0x1e/0x110
     [&lt;ffffffff810dd647&gt;] handle_edge_irq+0x77/0x110
     [&lt;ffffffff8100d362&gt;] handle_irq+0x22/0x40
     [&lt;ffffffff8157b28d&gt;] do_IRQ+0x5d/0xe0
     [&lt;ffffffff81571413&gt;] common_interrupt+0x13/0x13
&lt;EOI&gt;
     [&lt;ffffffff813003f7&gt;] ? intel_idle+0xd7/0x130
     [&lt;ffffffff813003f0&gt;] ? intel_idle+0xd0/0x130
     [&lt;ffffffff8144832b&gt;] cpuidle_idle_call+0xab/0x1c0
     [&lt;ffffffff8100a26b&gt;] cpu_idle+0xab/0xf0
     [&lt;ffffffff81566c59&gt;] start_secondary+0x1cb/0x1d2

Reported-by: Roland Dreier &lt;roland@purestorage.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
