<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/scsi, branch v4.8.16</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.8.16</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.8.16'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2016-12-15T16:50:35+00:00</updated>
<entry>
<title>scsi: lpfc: fix oops/BUG in lpfc_sli_ringtxcmpl_put()</title>
<updated>2016-12-15T16:50:35+00:00</updated>
<author>
<name>Mauricio Faria de Oliveira</name>
<email>mauricfo@linux.vnet.ibm.com</email>
</author>
<published>2016-11-23T12:33:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2a477999977c8ebf58835ca9f36586bbd13f4877'/>
<id>urn:sha1:2a477999977c8ebf58835ca9f36586bbd13f4877</id>
<content type='text'>
commit 2319f847a8910cff1d46c9b66aa1dd7cc3e836a9 upstream.

The BUG_ON() recently introduced in lpfc_sli_ringtxcmpl_put() is hit in
the lpfc_els_abort() &gt; lpfc_sli_issue_abort_iotag() &gt;
lpfc_sli_abort_iotag_issue() function path [similar names], due to
'piocb-&gt;vport == NULL':

	BUG_ON(!piocb || !piocb-&gt;vport);

This happens because lpfc_sli_abort_iotag_issue() doesn't set the
'abtsiocbp-&gt;vport' pointer -- but this is not the problem.

Previously, lpfc_sli_ringtxcmpl_put() accessed 'piocb-&gt;vport' only if
'piocb-&gt;iocb.ulpCommand' is neither CMD_ABORT_XRI_CN nor
CMD_CLOSE_XRI_CN, which are the only possible values for
lpfc_sli_abort_iotag_issue():

    lpfc_sli_ringtxcmpl_put():

        if ((unlikely(pring-&gt;ringno == LPFC_ELS_RING)) &amp;&amp;
           (piocb-&gt;iocb.ulpCommand != CMD_ABORT_XRI_CN) &amp;&amp;
           (piocb-&gt;iocb.ulpCommand != CMD_CLOSE_XRI_CN) &amp;&amp;
            (!(piocb-&gt;vport-&gt;load_flag &amp; FC_UNLOADING)))

    lpfc_sli_abort_iotag_issue():

        if (phba-&gt;link_state &gt;= LPFC_LINK_UP)
                iabt-&gt;ulpCommand = CMD_ABORT_XRI_CN;
        else
                iabt-&gt;ulpCommand = CMD_CLOSE_XRI_CN;

So, this function path would not have hit this possible NULL pointer
dereference before.

In order to fix this regression, move the second part of the BUG_ON()
check prior to the pointer dereference that it does check for.

For reference, this is the stack trace observed. The problem happened
because an unsolicited event was received - a PLOGI was received after
our PLOGI was issued but not yet complete, so the discovery state
machine goes on to sw-abort our PLOGI.

    kernel BUG at drivers/scsi/lpfc/lpfc_sli.c:1326!
    Oops: Exception in kernel mode, sig: 5 [#1]
    &lt;...&gt;
    NIP [...] lpfc_sli_ringtxcmpl_put+0x1c/0xf0 [lpfc]
    LR  [...] __lpfc_sli_issue_iocb_s4+0x188/0x200 [lpfc]
    Call Trace:
    [...] [...] __lpfc_sli_issue_iocb_s4+0xb0/0x200 [lpfc] (unreliable)
    [...] [...] lpfc_sli_issue_abort_iotag+0x2b4/0x350 [lpfc]
    [...] [...] lpfc_els_abort+0x1a8/0x4a0 [lpfc]
    [...] [...] lpfc_rcv_plogi+0x6d4/0x700 [lpfc]
    [...] [...] lpfc_rcv_plogi_plogi_issue+0xd8/0x1d0 [lpfc]
    [...] [...] lpfc_disc_state_machine+0xc0/0x2b0 [lpfc]
    [...] [...] lpfc_els_unsol_buffer+0xcc0/0x26c0 [lpfc]
    [...] [...] lpfc_els_unsol_event+0xa8/0x220 [lpfc]
    [...] [...] lpfc_complete_unsol_iocb+0xb8/0x138 [lpfc]
    [...] [...] lpfc_sli4_handle_received_buffer+0x6a0/0xec0 [lpfc]
    [...] [...] lpfc_sli_handle_slow_ring_event_s4+0x1c4/0x240 [lpfc]
    [...] [...] lpfc_sli_handle_slow_ring_event+0x24/0x40 [lpfc]
    [...] [...] lpfc_do_work+0xd88/0x1970 [lpfc]
    [...] [...] kthread+0x108/0x130
    [...] [...] ret_from_kernel_thread+0x5c/0xbc
    &lt;...&gt;

Fixes: 22466da5b4b7 ("lpfc: Fix possible NULL pointer dereference")
Reported-by: Harsha Thyagaraja &lt;hathyaga@in.ibm.com&gt;
Signed-off-by: Mauricio Faria de Oliveira &lt;mauricfo@linux.vnet.ibm.com&gt;
Reviewed-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: libfc: fix seconds_since_last_reset miscalculation</title>
<updated>2016-12-08T06:16:17+00:00</updated>
<author>
<name>Johannes Thumshirn</name>
<email>jthumshirn@suse.de</email>
</author>
<published>2016-11-17T11:50:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8d1ee7b245ef50b497f1f1f57b74cae3285accf2'/>
<id>urn:sha1:8d1ee7b245ef50b497f1f1f57b74cae3285accf2</id>
<content type='text'>
commit 208da78e8ec8b6d6ce3747ab0e5c120458e08ae6 upstream.

Commit 540eb1eef0ab ("scsi: libfc: fix seconds_since_last_reset calculation")
removed the use of 'struct timespec' from fc_get_host_stats(). This broke the
output of 'fcoeadm -s' after kernel 4.8-rc1.

Signed-off-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Fixes: 540eb1eef0ab ("scsi: libfc: fix seconds_since_last_reset calculation")
Acked-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Reviewed-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: hpsa: use bus '3' for legacy HBA devices</title>
<updated>2016-12-08T06:16:17+00:00</updated>
<author>
<name>Hannes Reinecke</name>
<email>hare@suse.de</email>
</author>
<published>2016-11-17T11:15:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=10e2627377b01b5dbfae039573cea2e4fa508483'/>
<id>urn:sha1:10e2627377b01b5dbfae039573cea2e4fa508483</id>
<content type='text'>
commit 7630b3a599e2c6d1c042945d32ff2debc855ad29 upstream.

Older controllers use SCSI target id '0' for the first internal disk. As
the controllers are now placed on the same bus as the internal disks
this leads to a clash with the SCSI target id of controller.  This patch
checks the SCSI revision, and moves older controller to bus '3' to be
compatible with older releases and avoid this problem.

[mkp: fixed uninitialized variable]

Fixes: 09371d623c9 ("hpsa: Change SAS transport devices to bus 0.")
Signed-off-by: Hannes Reinecke &lt;hare@suse.com&gt;
Acked-by: Don Brace &lt;don.brace@microsemi.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: mpt3sas: Unblock device after controller reset</title>
<updated>2016-12-02T08:10:33+00:00</updated>
<author>
<name>Suganath Prabu S</name>
<email>suganath-prabu.subramani@broadcom.com</email>
</author>
<published>2016-11-17T10:45:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f81c90012f2f1facc0b292d9ad63631ec964cd50'/>
<id>urn:sha1:f81c90012f2f1facc0b292d9ad63631ec964cd50</id>
<content type='text'>
commit 7ff723ad0f87feba43dda45fdae71206063dd7d4 upstream.

While issuing any ATA passthrough command to firmware the driver will
block the device. But it will unblock the device only if the I/O
completes through the ISR path. If a controller reset occurs before
command completion the device will remain in blocked state.

Make sure we unblock the device following a controller reset if an ATA
passthrough command was queued.

[mkp: clarified patch description]

Fixes: ac6c2a93bd07 ("mpt3sas: Fix for SATA drive in blocked state, after diag reset")
Signed-off-by: Suganath Prabu S &lt;suganath-prabu.subramani@broadcom.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: mpt3sas: Fix secure erase premature termination</title>
<updated>2016-12-02T08:10:31+00:00</updated>
<author>
<name>Andrey Grodzovsky</name>
<email>andrey2805@gmail.com</email>
</author>
<published>2016-11-10T14:35:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c707019bef623c72dc52235fb233bfe33decc744'/>
<id>urn:sha1:c707019bef623c72dc52235fb233bfe33decc744</id>
<content type='text'>
commit 18f6084a989ba1b38702f9af37a2e4049a924be6 upstream.

This is a work around for a bug with LSI Fusion MPT SAS2 when perfoming
secure erase. Due to the very long time the operation takes, commands
issued during the erase will time out and will trigger execution of the
abort hook. Even though the abort hook is called for the specific
command which timed out, this leads to entire device halt
(scsi_state terminated) and premature termination of the secure erase.

Set device state to busy while ATA passthrough commands are in progress.

[mkp: hand applied to 4.9/scsi-fixes, tweaked patch description]

Signed-off-by: Andrey Grodzovsky &lt;andrey2805@gmail.com&gt;
Acked-by: Sreekanth Reddy &lt;Sreekanth.Reddy@broadcom.com&gt;
Cc: &lt;linux-scsi@vger.kernel.org&gt;
Cc: Sathya Prakash &lt;sathya.prakash@broadcom.com&gt;
Cc: Chaitra P B &lt;chaitra.basappa@broadcom.com&gt;
Cc: Suganath Prabu Subramani &lt;suganath-prabu.subramani@broadcom.com&gt;
Cc: Sreekanth Reddy &lt;Sreekanth.Reddy@broadcom.com&gt;
Cc: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: scsi_dh_alua: Fix a reference counting bug</title>
<updated>2016-11-18T09:51:48+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bart.vanassche@sandisk.com</email>
</author>
<published>2016-11-01T14:19:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2850fad5acb02d58e45bf7cab169418aab8c51f4'/>
<id>urn:sha1:2850fad5acb02d58e45bf7cab169418aab8c51f4</id>
<content type='text'>
commit df3d422cbac685da882e4c239dfda07de33d431b upstream.

The code at the end of alua_rtpg_work() is as follows:

	scsi_device_put(sdev);
	kref_put(&amp;pg-&gt;kref, release_port_group);

In other words, alua_rtpg_queue() must hold an sdev reference and a pg
reference before queueing rtpg work. If no rtpg work is queued no
additional references should be held when alua_rtpg_queue() returns. If
no rtpg work is queued, ensure that alua_rtpg_queue() only gives up the
sdev reference if that reference was obtained by the same
alua_rtpg_queue() call.

Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Reported-by: Tang Junhui &lt;tang.junhui@zte.com.cn&gt;
Cc: Hannes Reinecke &lt;hare@suse.com&gt;
Cc: Tang Junhui &lt;tang.junhui@zte.com.cn&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: scsi_dh_alua: fix missing kref_put() in alua_rtpg_work()</title>
<updated>2016-11-18T09:51:48+00:00</updated>
<author>
<name>tang.junhui</name>
<email>tang.junhui@zte.com.cn</email>
</author>
<published>2016-10-28T07:54:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5fac70d772a4d360eb3453f76f860c68eb192f1d'/>
<id>urn:sha1:5fac70d772a4d360eb3453f76f860c68eb192f1d</id>
<content type='text'>
commit 1fdd14279eab2e9f79745631379f0c53cb8f9a5a upstream.

Reference count of pg leaks in alua_rtpg_work() since kref_put() is not
called to decrease the reference count of pg when the condition
pg-&gt;rtpg_sdev==NULL satisfied (actually it is easy to satisfy), it would
cause memory of pg leakage.

Signed-off-by: tang.junhui &lt;tang.junhui@zte.com.cn&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: mpt3sas: Fix for block device of raid exists even after deleting raid disk</title>
<updated>2016-11-18T09:51:48+00:00</updated>
<author>
<name>Sreekanth Reddy</name>
<email>sreekanth.reddy@broadcom.com</email>
</author>
<published>2016-10-28T04:39:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f29bcd11a170cb44ba36ef3bef22d7af147f1718'/>
<id>urn:sha1:f29bcd11a170cb44ba36ef3bef22d7af147f1718</id>
<content type='text'>
commit 6d3a56ed098566bc83d6c2afa74b4199c12ea074 upstream.

While merging mpt3sas &amp; mpt2sas code, we added the is_warpdrive check
condition on the wrong line

---------------------------------------------------------------------------
 scsih_target_alloc(struct scsi_target *starget)
                        sas_target_priv_data-&gt;handle = raid_device-&gt;handle;
                        sas_target_priv_data-&gt;sas_address = raid_device-&gt;wwid;
                        sas_target_priv_data-&gt;flags |= MPT_TARGET_FLAGS_VOLUME;
-                       raid_device-&gt;starget = starget;
+                       sas_target_priv_data-&gt;raid_device = raid_device;
+                       if (ioc-&gt;is_warpdrive)
+                               raid_device-&gt;starget = starget;
                }
                spin_unlock_irqrestore(&amp;ioc-&gt;raid_device_lock, flags);
                return 0;
------------------------------------------------------------------------------

That check should be for the line sas_target_priv_data-&gt;raid_device =
raid_device;

Due to above hunk, we are not initializing raid_device's starget for
raid volumes, and so during raid disk deletion driver is not calling
scsi_remove_target() API as driver observes starget field of
raid_device's structure as NULL.

Signed-off-by: Sreekanth Reddy &lt;Sreekanth.Reddy@broadcom.com&gt;
Fixes: 7786ab6aff9 ("mpt3sas: Ported WarpDrive product SSS6200 support")
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: qla2xxx: Fix scsi scan hang triggered if adapter fails during init</title>
<updated>2016-11-18T09:51:48+00:00</updated>
<author>
<name>Bill Kuzeja</name>
<email>William.Kuzeja@stratus.com</email>
</author>
<published>2016-10-21T20:45:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b2040deabb0737158300e55d071890c2dc0fc084'/>
<id>urn:sha1:b2040deabb0737158300e55d071890c2dc0fc084</id>
<content type='text'>
commit a5dd506e1584e91f3e7500ab9a165aa1b49eabd4 upstream.

A system can get hung task timeouts if a qlogic board fails during
initialization (if the board breaks again or fails the init). The hang
involves the scsi scan.

In a nutshell, since commit beb9e315e6e0 ("qla2xxx: Prevent removal and
board_disable race"):

...it is possible to have freed ha (base_vha-&gt;hw) early by a call to
qla2x00_remove_one when pdev-&gt;enable_cnt equals zero:

       if (!atomic_read(&amp;pdev-&gt;enable_cnt)) {
               scsi_host_put(base_vha-&gt;host);
               kfree(ha);
               pci_set_drvdata(pdev, NULL);
               return;

Almost always, the scsi_host_put above frees the vha structure
(attached to the end of the Scsi_Host we're putting) since it's the last
put, and life is good.  However, if we are entering this routine because
the adapter has broken sometime during initialization AND a scsi scan is
already in progress (and has done its own scsi_host_get), vha will not
be freed. What's worse, the scsi scan will access the freed ha structure
through qla2xxx_scan_finished:

        if (time &gt; vha-&gt;hw-&gt;loop_reset_delay * HZ)
                return 1;

The scsi scan keeps checking to see if a scan is complete by calling
qla2xxx_scan_finished. There is a timeout value that limits the length
of time a scan can take (hw-&gt;loop_reset_delay, usually set to 5
seconds), but this definition is in the data structure (hw) that can get
freed early.

This can yield unpredictable results, the worst of which is that the
scsi scan can hang indefinitely. This happens when the freed structure
gets reused and loop_reset_delay gets overwritten with garbage, which
the scan obliviously uses as its timeout value.

The fix for this is simple: at the top of qla2xxx_scan_finished, check
for the UNLOADING bit in the vha structure (_vha is not freed at this
point).  If UNLOADING is set, we exit the scan for this adapter
immediately. After this last reference to the ha structure, we'll exit
the scan for this adapter, and continue on.

This problem is hard to hit, but I have run into it doing negative
testing many times now (with a test specifically designed to bring it
out), so I can verify that this fix works. My testing has been against a
RHEL7 driver variant, but the bug and patch are equally relevant to to
the upstream driver.

Fixes: beb9e315e6e0 ("qla2xxx: Prevent removal and board_disable race")
Signed-off-by: Bill Kuzeja &lt;william.kuzeja@stratus.com&gt;
Acked-by: Himanshu Madhani &lt;himanshu.madhani@cavium.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression</title>
<updated>2016-11-15T06:48:54+00:00</updated>
<author>
<name>Sumit Saxena</name>
<email>sumit.saxena@broadcom.com</email>
</author>
<published>2016-11-09T10:59:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8ed841d6c045c31c3309b70395b920cb707537d4'/>
<id>urn:sha1:8ed841d6c045c31c3309b70395b920cb707537d4</id>
<content type='text'>
commit 5e5ec1759dd663a1d5a2f10930224dd009e500e8 upstream.

This patch will fix regression caused by commit 1e793f6fc0db ("scsi:
megaraid_sas: Fix data integrity failure for JBOD (passthrough)
devices").

The problem was that the MEGASAS_IS_LOGICAL macro did not have braces
and as a result the driver ended up exposing a lot of non-existing SCSI
devices (all SCSI commands to channels 1,2,3 were returned as
SUCCESS-DID_OK by driver).

[mkp: clarified patch description]

Fixes: 1e793f6fc0db920400574211c48f9157a37e3945
Reported-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Signed-off-by: Kashyap Desai &lt;kashyap.desai@broadcom.com&gt;
Signed-off-by: Sumit Saxena &lt;sumit.saxena@broadcom.com&gt;
Tested-by: Sumit Saxena &lt;sumit.saxena@broadcom.com&gt;
Reviewed-by: Tomas Henzl &lt;thenzl@redhat.com&gt;
Tested-by: Jens Axboe &lt;axboe@fb.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
</feed>
