<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/scsi, branch v4.4.31</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>scsi: arcmsr: Send SYNCHRONIZE_CACHE command to firmware</title>
<updated>2016-11-10T15:36:35+00:00</updated>
<author>
<name>Ching Huang</name>
<email>ching2048@areca.com.tw</email>
</author>
<published>2016-10-19T09:50:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c77a2346226e77e3f1d243810eb2bb75b407f2b4'/>
<id>c77a2346226e77e3f1d243810eb2bb75b407f2b4</id>
<content type='text'>
commit 2bf7dc8443e113844d078fd6541b7f4aa544f92f upstream.

The arcmsr driver failed to pass SYNCHRONIZE CACHE to controller
firmware. Depending on how drive caches are handled internally by
controller firmware this could potentially lead to data integrity
problems.

Ensure that cache flushes are passed to the controller.

[mkp: applied by hand and removed unused vars]

Signed-off-by: Ching Huang &lt;ching2048@areca.com.tw&gt;
Reported-by: Tomas Henzl &lt;thenzl@redhat.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 2bf7dc8443e113844d078fd6541b7f4aa544f92f upstream.

The arcmsr driver failed to pass SYNCHRONIZE CACHE to controller
firmware. Depending on how drive caches are handled internally by
controller firmware this could potentially lead to data integrity
problems.

Ensure that cache flushes are passed to the controller.

[mkp: applied by hand and removed unused vars]

Signed-off-by: Ching Huang &lt;ching2048@areca.com.tw&gt;
Reported-by: Tomas Henzl &lt;thenzl@redhat.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;

</pre>
</div>
</content>
</entry>
<entry>
<title>scsi: scsi_debug: Fix memory leak if LBP enabled and module is unloaded</title>
<updated>2016-11-10T15:36:35+00:00</updated>
<author>
<name>Ewan D. Milne</name>
<email>emilne@redhat.com</email>
</author>
<published>2016-10-26T15:22:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=69ee0ed0c6f96eb7182b2dd83393e6fca5ade81c'/>
<id>69ee0ed0c6f96eb7182b2dd83393e6fca5ade81c</id>
<content type='text'>
commit 4d2b496f19f3c2cfaca1e8fa0710688b5ff3811d upstream.

map_storep was not being vfree()'d in the module_exit call.

Signed-off-by: Ewan D. Milne &lt;emilne@redhat.com&gt;
Reviewed-by: Laurence Oberman &lt;loberman@redhat.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 4d2b496f19f3c2cfaca1e8fa0710688b5ff3811d upstream.

map_storep was not being vfree()'d in the module_exit call.

Signed-off-by: Ewan D. Milne &lt;emilne@redhat.com&gt;
Reviewed-by: Laurence Oberman &lt;loberman@redhat.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;

</pre>
</div>
</content>
</entry>
<entry>
<title>scsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices</title>
<updated>2016-11-10T15:36:35+00:00</updated>
<author>
<name>Kashyap Desai</name>
<email>kashyap.desai@broadcom.com</email>
</author>
<published>2016-10-21T13:33:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9075faf1406cdbd2a7b6ce8c32b3899109ecdf63'/>
<id>9075faf1406cdbd2a7b6ce8c32b3899109ecdf63</id>
<content type='text'>
commit 1e793f6fc0db920400574211c48f9157a37e3945 upstream.

Commit 02b01e010afe ("megaraid_sas: return sync cache call with
success") modified the driver to successfully complete SYNCHRONIZE_CACHE
commands without passing them to the controller. Disk drive caches are
only explicitly managed by controller firmware when operating in RAID
mode. So this commit effectively disabled writeback cache flushing for
any drives used in JBOD mode, leading to data integrity failures.

[mkp: clarified patch description]

Fixes: 02b01e010afeeb49328d35650d70721d2ca3fd59
Signed-off-by: Kashyap Desai &lt;kashyap.desai@broadcom.com&gt;
Signed-off-by: Sumit Saxena &lt;sumit.saxena@broadcom.com&gt;
Reviewed-by: Tomas Henzl &lt;thenzl@redhat.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.com&gt;
Reviewed-by: Ewan D. Milne &lt;emilne@redhat.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 1e793f6fc0db920400574211c48f9157a37e3945 upstream.

Commit 02b01e010afe ("megaraid_sas: return sync cache call with
success") modified the driver to successfully complete SYNCHRONIZE_CACHE
commands without passing them to the controller. Disk drive caches are
only explicitly managed by controller firmware when operating in RAID
mode. So this commit effectively disabled writeback cache flushing for
any drives used in JBOD mode, leading to data integrity failures.

[mkp: clarified patch description]

Fixes: 02b01e010afeeb49328d35650d70721d2ca3fd59
Signed-off-by: Kashyap Desai &lt;kashyap.desai@broadcom.com&gt;
Signed-off-by: Sumit Saxena &lt;sumit.saxena@broadcom.com&gt;
Reviewed-by: Tomas Henzl &lt;thenzl@redhat.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.com&gt;
Reviewed-by: Ewan D. Milne &lt;emilne@redhat.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;

</pre>
</div>
</content>
</entry>
<entry>
<title>mpt3sas: Don't spam logs if logging level is 0</title>
<updated>2016-10-31T10:14:01+00:00</updated>
<author>
<name>Johannes Thumshirn</name>
<email>jthumshirn@suse.de</email>
</author>
<published>2016-08-03T13:00:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=2577121578e1857f6438d182ffa1f34d5c9cc8c8'/>
<id>2577121578e1857f6438d182ffa1f34d5c9cc8c8</id>
<content type='text'>
commit 0d667f72b2a20bbac72bec0ab11467fc70bb0f1f upstream.

In _scsih_io_done() we test if the ioc-&gt;logging_level does _not_ have
the MPT_DEBUG_REPLY bit set and if it hasn't we print the debug
messages. This unfortunately is the wrong way around.

Note, the actual bug is older than af0094115 but this commit removed the
CONFIG_SCSI_MPT3SAS_LOGGING Kconfig option which hid the bug.

Fixes: af0094115 'mpt2sas, mpt3sas: Remove SCSI_MPTXSAS_LOGGING entry from Kconfig'
Signed-off-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Acked-by: Chaitra P B &lt;chaitra.basappa@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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 0d667f72b2a20bbac72bec0ab11467fc70bb0f1f upstream.

In _scsih_io_done() we test if the ioc-&gt;logging_level does _not_ have
the MPT_DEBUG_REPLY bit set and if it hasn't we print the debug
messages. This unfortunately is the wrong way around.

Note, the actual bug is older than af0094115 but this commit removed the
CONFIG_SCSI_MPT3SAS_LOGGING Kconfig option which hid the bug.

Fixes: af0094115 'mpt2sas, mpt3sas: Remove SCSI_MPTXSAS_LOGGING entry from Kconfig'
Signed-off-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Acked-by: Chaitra P B &lt;chaitra.basappa@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;

</pre>
</div>
</content>
</entry>
<entry>
<title>hpsa: correct skipping masked peripherals</title>
<updated>2016-10-28T07:01:33+00:00</updated>
<author>
<name>Don Brace</name>
<email>don.brace@microsemi.com</email>
</author>
<published>2016-07-01T18:37:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=652a174a7d14e5334d2a3f5aa9be9ba52d293bc2'/>
<id>652a174a7d14e5334d2a3f5aa9be9ba52d293bc2</id>
<content type='text'>
commit 64ce60cab24603ac0fcd59c9fbc3be78f4c4d229 upstream.

The SA controller spins down RAID drive spares.

A REGNEWD event causes an inquiry to be sent to all physical
drives. This causes the SA controller to spin up the spare.

The controller suspends all I/O to a logical volume until
the spare is spun up. The spin-up can take over 50 seconds.

This can result in one or both of the following:
 - SML sends down aborts and resets to the logical volume
   and can cause the logical volume to be off-lined.
 - a negative impact on the logical volume's I/O performance
   each time a REGNEWD is triggered.

Reviewed-by: Scott Teel &lt;scott.teel@microsemi.com&gt;
Reviewed-by: Kevin Barnett &lt;kevin.barnett@microsemi.com&gt;
Signed-off-by: Don Brace &lt;don.brace@microsemi.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Juerg Haefliger &lt;juerg.haefliger@hpe.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

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

The SA controller spins down RAID drive spares.

A REGNEWD event causes an inquiry to be sent to all physical
drives. This causes the SA controller to spin up the spare.

The controller suspends all I/O to a logical volume until
the spare is spun up. The spin-up can take over 50 seconds.

This can result in one or both of the following:
 - SML sends down aborts and resets to the logical volume
   and can cause the logical volume to be off-lined.
 - a negative impact on the logical volume's I/O performance
   each time a REGNEWD is triggered.

Reviewed-by: Scott Teel &lt;scott.teel@microsemi.com&gt;
Reviewed-by: Kevin Barnett &lt;kevin.barnett@microsemi.com&gt;
Signed-off-by: Don Brace &lt;don.brace@microsemi.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Juerg Haefliger &lt;juerg.haefliger@hpe.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>sd: Fix rw_max for devices that report an optimal xfer size</title>
<updated>2016-10-28T07:01:33+00:00</updated>
<author>
<name>Martin K. Petersen</name>
<email>martin.petersen@oracle.com</email>
</author>
<published>2016-05-13T02:17:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9814eb75495bcd2fd2fc234bd474f0c395407c4c'/>
<id>9814eb75495bcd2fd2fc234bd474f0c395407c4c</id>
<content type='text'>
commit 6b7e9cde49691e04314342b7dce90c67ad567fcc upstream.

For historic reasons, io_opt is in bytes and max_sectors in block layer
sectors. This interface inconsistency is error prone and should be
fixed. But for 4.4--4.7 let's make the unit difference explicit via a
wrapper function.

Fixes: d0eb20a863ba ("sd: Optimal I/O size is in bytes, not sectors")
Reported-by: Fam Zheng &lt;famz@redhat.com&gt;
Reviewed-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Tested-by: Andrew Patterson &lt;andrew.patterson@hpe.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Juerg Haefliger &lt;juerg.haefliger@hpe.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 6b7e9cde49691e04314342b7dce90c67ad567fcc upstream.

For historic reasons, io_opt is in bytes and max_sectors in block layer
sectors. This interface inconsistency is error prone and should be
fixed. But for 4.4--4.7 let's make the unit difference explicit via a
wrapper function.

Fixes: d0eb20a863ba ("sd: Optimal I/O size is in bytes, not sectors")
Reported-by: Fam Zheng &lt;famz@redhat.com&gt;
Reviewed-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Tested-by: Andrew Patterson &lt;andrew.patterson@hpe.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Juerg Haefliger &lt;juerg.haefliger@hpe.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scsi: Fix use-after-free</title>
<updated>2016-10-28T07:01:31+00:00</updated>
<author>
<name>Ming Lei</name>
<email>tom.leiming@gmail.com</email>
</author>
<published>2016-10-09T05:23:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=bffff9301e1dde678ebe511636999dffa2dfa117'/>
<id>bffff9301e1dde678ebe511636999dffa2dfa117</id>
<content type='text'>
commit bcd8f2e94808fcddf6ef3af5f060a36820dcc432 upstream.

This patch fixes one use-after-free report[1] by KASAN.

In __scsi_scan_target(), when a type 31 device is probed,
SCSI_SCAN_TARGET_PRESENT is returned and the target will be scanned
again.

Inside the following scsi_report_lun_scan(), one new scsi_device
instance is allocated, and scsi_probe_and_add_lun() is called again to
probe the target and still see type 31 device, finally
__scsi_remove_device() is called to remove &amp; free the device at the end
of scsi_probe_and_add_lun(), so cause use-after-free in
scsi_report_lun_scan().

And the following SCSI log can be observed:

	scsi 0:0:2:0: scsi scan: INQUIRY pass 1 length 36
	scsi 0:0:2:0: scsi scan: INQUIRY successful with code 0x0
	scsi 0:0:2:0: scsi scan: peripheral device type of 31, no device added
	scsi 0:0:2:0: scsi scan: Sending REPORT LUNS to (try 0)
	scsi 0:0:2:0: scsi scan: REPORT LUNS successful (try 0) result 0x0
	scsi 0:0:2:0: scsi scan: REPORT LUN scan
	scsi 0:0:2:0: scsi scan: INQUIRY pass 1 length 36
	scsi 0:0:2:0: scsi scan: INQUIRY successful with code 0x0
	scsi 0:0:2:0: scsi scan: peripheral device type of 31, no device added
	BUG: KASAN: use-after-free in __scsi_scan_target+0xbf8/0xe40 at addr ffff88007b44a104

This patch fixes the issue by moving the putting reference at
the end of scsi_report_lun_scan().

[1] KASAN report
==================================================================
[    3.274597] PM: Adding info for serio:serio1
[    3.275127] BUG: KASAN: use-after-free in __scsi_scan_target+0xd87/0xdf0 at addr ffff880254d8c304
[    3.275653] Read of size 4 by task kworker/u10:0/27
[    3.275903] CPU: 3 PID: 27 Comm: kworker/u10:0 Not tainted 4.8.0 #2121
[    3.276258] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
[    3.276797] Workqueue: events_unbound async_run_entry_fn
[    3.277083]  ffff880254d8c380 ffff880259a37870 ffffffff94bbc6c1 ffff880078402d80
[    3.277532]  ffff880254d8bb80 ffff880259a37898 ffffffff9459fec1 ffff880259a37930
[    3.277989]  ffff880254d8bb80 ffff880078402d80 ffff880259a37920 ffffffff945a0165
[    3.278436] Call Trace:
[    3.278528]  [&lt;ffffffff94bbc6c1&gt;] dump_stack+0x65/0x84
[    3.278797]  [&lt;ffffffff9459fec1&gt;] kasan_object_err+0x21/0x70
[    3.279063] device: 'psaux': device_add
[    3.279616]  [&lt;ffffffff945a0165&gt;] kasan_report_error+0x205/0x500
[    3.279651] PM: Adding info for No Bus:psaux
[    3.280202]  [&lt;ffffffff944ecd22&gt;] ? kfree_const+0x22/0x30
[    3.280486]  [&lt;ffffffff94bc2dc9&gt;] ? kobject_release+0x119/0x370
[    3.280805]  [&lt;ffffffff945a0543&gt;] __asan_report_load4_noabort+0x43/0x50
[    3.281170]  [&lt;ffffffff9507e1f7&gt;] ? __scsi_scan_target+0xd87/0xdf0
[    3.281506]  [&lt;ffffffff9507e1f7&gt;] __scsi_scan_target+0xd87/0xdf0
[    3.281848]  [&lt;ffffffff9507d470&gt;] ? scsi_add_device+0x30/0x30
[    3.282156]  [&lt;ffffffff94f7f660&gt;] ? pm_runtime_autosuspend_expiration+0x60/0x60
[    3.282570]  [&lt;ffffffff956ddb07&gt;] ? _raw_spin_lock+0x17/0x40
[    3.282880]  [&lt;ffffffff9507e505&gt;] scsi_scan_channel+0x105/0x160
[    3.283200]  [&lt;ffffffff9507e8a2&gt;] scsi_scan_host_selected+0x212/0x2f0
[    3.283563]  [&lt;ffffffff9507eb3c&gt;] do_scsi_scan_host+0x1bc/0x250
[    3.283882]  [&lt;ffffffff9507efc1&gt;] do_scan_async+0x41/0x450
[    3.284173]  [&lt;ffffffff941c1fee&gt;] async_run_entry_fn+0xfe/0x610
[    3.284492]  [&lt;ffffffff941a8954&gt;] ? pwq_dec_nr_in_flight+0x124/0x2a0
[    3.284876]  [&lt;ffffffff941d1770&gt;] ? preempt_count_add+0x130/0x160
[    3.285207]  [&lt;ffffffff941a9a84&gt;] process_one_work+0x544/0x12d0
[    3.285526]  [&lt;ffffffff941aa8e9&gt;] worker_thread+0xd9/0x12f0
[    3.285844]  [&lt;ffffffff941aa810&gt;] ? process_one_work+0x12d0/0x12d0
[    3.286182]  [&lt;ffffffff941bb365&gt;] kthread+0x1c5/0x260
[    3.286443]  [&lt;ffffffff940855cd&gt;] ? __switch_to+0x88d/0x1430
[    3.286745]  [&lt;ffffffff941bb1a0&gt;] ? kthread_worker_fn+0x5a0/0x5a0
[    3.287085]  [&lt;ffffffff956dde9f&gt;] ret_from_fork+0x1f/0x40
[    3.287368]  [&lt;ffffffff941bb1a0&gt;] ? kthread_worker_fn+0x5a0/0x5a0
[    3.287697] Object at ffff880254d8bb80, in cache kmalloc-2048 size: 2048
[    3.288064] Allocated:
[    3.288147] PID = 27
[    3.288218]  [&lt;ffffffff940b27ab&gt;] save_stack_trace+0x2b/0x50
[    3.288531]  [&lt;ffffffff9459f246&gt;] save_stack+0x46/0xd0
[    3.288806]  [&lt;ffffffff9459f4bd&gt;] kasan_kmalloc+0xad/0xe0
[    3.289098]  [&lt;ffffffff9459c07e&gt;] __kmalloc+0x13e/0x250
[    3.289378]  [&lt;ffffffff95078e5a&gt;] scsi_alloc_sdev+0xea/0xcf0
[    3.289701]  [&lt;ffffffff9507de76&gt;] __scsi_scan_target+0xa06/0xdf0
[    3.290034]  [&lt;ffffffff9507e505&gt;] scsi_scan_channel+0x105/0x160
[    3.290362]  [&lt;ffffffff9507e8a2&gt;] scsi_scan_host_selected+0x212/0x2f0
[    3.290724]  [&lt;ffffffff9507eb3c&gt;] do_scsi_scan_host+0x1bc/0x250
[    3.291055]  [&lt;ffffffff9507efc1&gt;] do_scan_async+0x41/0x450
[    3.291354]  [&lt;ffffffff941c1fee&gt;] async_run_entry_fn+0xfe/0x610
[    3.291695]  [&lt;ffffffff941a9a84&gt;] process_one_work+0x544/0x12d0
[    3.292022]  [&lt;ffffffff941aa8e9&gt;] worker_thread+0xd9/0x12f0
[    3.292325]  [&lt;ffffffff941bb365&gt;] kthread+0x1c5/0x260
[    3.292594]  [&lt;ffffffff956dde9f&gt;] ret_from_fork+0x1f/0x40
[    3.292886] Freed:
[    3.292945] PID = 27
[    3.293016]  [&lt;ffffffff940b27ab&gt;] save_stack_trace+0x2b/0x50
[    3.293327]  [&lt;ffffffff9459f246&gt;] save_stack+0x46/0xd0
[    3.293600]  [&lt;ffffffff9459fa61&gt;] kasan_slab_free+0x71/0xb0
[    3.293916]  [&lt;ffffffff9459bac2&gt;] kfree+0xa2/0x1f0
[    3.294168]  [&lt;ffffffff9508158a&gt;] scsi_device_dev_release_usercontext+0x50a/0x730
[    3.294598]  [&lt;ffffffff941ace9a&gt;] execute_in_process_context+0xda/0x130
[    3.294974]  [&lt;ffffffff9508107c&gt;] scsi_device_dev_release+0x1c/0x20
[    3.295322]  [&lt;ffffffff94f566f6&gt;] device_release+0x76/0x1e0
[    3.295626]  [&lt;ffffffff94bc2db7&gt;] kobject_release+0x107/0x370
[    3.295942]  [&lt;ffffffff94bc29ce&gt;] kobject_put+0x4e/0xa0
[    3.296222]  [&lt;ffffffff94f56e17&gt;] put_device+0x17/0x20
[    3.296497]  [&lt;ffffffff9505201c&gt;] scsi_device_put+0x7c/0xa0
[    3.296801]  [&lt;ffffffff9507e1bc&gt;] __scsi_scan_target+0xd4c/0xdf0
[    3.297132]  [&lt;ffffffff9507e505&gt;] scsi_scan_channel+0x105/0x160
[    3.297458]  [&lt;ffffffff9507e8a2&gt;] scsi_scan_host_selected+0x212/0x2f0
[    3.297829]  [&lt;ffffffff9507eb3c&gt;] do_scsi_scan_host+0x1bc/0x250
[    3.298156]  [&lt;ffffffff9507efc1&gt;] do_scan_async+0x41/0x450
[    3.298453]  [&lt;ffffffff941c1fee&gt;] async_run_entry_fn+0xfe/0x610
[    3.298777]  [&lt;ffffffff941a9a84&gt;] process_one_work+0x544/0x12d0
[    3.299105]  [&lt;ffffffff941aa8e9&gt;] worker_thread+0xd9/0x12f0
[    3.299408]  [&lt;ffffffff941bb365&gt;] kthread+0x1c5/0x260
[    3.299676]  [&lt;ffffffff956dde9f&gt;] ret_from_fork+0x1f/0x40
[    3.299967] Memory state around the buggy address:
[    3.300209]  ffff880254d8c200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[    3.300608]  ffff880254d8c280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[    3.300986] &gt;ffff880254d8c300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[    3.301408]                    ^
[    3.301550]  ffff880254d8c380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[    3.301987]  ffff880254d8c400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    3.302396]
==================================================================

Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Ming Lei &lt;tom.leiming@gmail.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit bcd8f2e94808fcddf6ef3af5f060a36820dcc432 upstream.

This patch fixes one use-after-free report[1] by KASAN.

In __scsi_scan_target(), when a type 31 device is probed,
SCSI_SCAN_TARGET_PRESENT is returned and the target will be scanned
again.

Inside the following scsi_report_lun_scan(), one new scsi_device
instance is allocated, and scsi_probe_and_add_lun() is called again to
probe the target and still see type 31 device, finally
__scsi_remove_device() is called to remove &amp; free the device at the end
of scsi_probe_and_add_lun(), so cause use-after-free in
scsi_report_lun_scan().

And the following SCSI log can be observed:

	scsi 0:0:2:0: scsi scan: INQUIRY pass 1 length 36
	scsi 0:0:2:0: scsi scan: INQUIRY successful with code 0x0
	scsi 0:0:2:0: scsi scan: peripheral device type of 31, no device added
	scsi 0:0:2:0: scsi scan: Sending REPORT LUNS to (try 0)
	scsi 0:0:2:0: scsi scan: REPORT LUNS successful (try 0) result 0x0
	scsi 0:0:2:0: scsi scan: REPORT LUN scan
	scsi 0:0:2:0: scsi scan: INQUIRY pass 1 length 36
	scsi 0:0:2:0: scsi scan: INQUIRY successful with code 0x0
	scsi 0:0:2:0: scsi scan: peripheral device type of 31, no device added
	BUG: KASAN: use-after-free in __scsi_scan_target+0xbf8/0xe40 at addr ffff88007b44a104

This patch fixes the issue by moving the putting reference at
the end of scsi_report_lun_scan().

[1] KASAN report
==================================================================
[    3.274597] PM: Adding info for serio:serio1
[    3.275127] BUG: KASAN: use-after-free in __scsi_scan_target+0xd87/0xdf0 at addr ffff880254d8c304
[    3.275653] Read of size 4 by task kworker/u10:0/27
[    3.275903] CPU: 3 PID: 27 Comm: kworker/u10:0 Not tainted 4.8.0 #2121
[    3.276258] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
[    3.276797] Workqueue: events_unbound async_run_entry_fn
[    3.277083]  ffff880254d8c380 ffff880259a37870 ffffffff94bbc6c1 ffff880078402d80
[    3.277532]  ffff880254d8bb80 ffff880259a37898 ffffffff9459fec1 ffff880259a37930
[    3.277989]  ffff880254d8bb80 ffff880078402d80 ffff880259a37920 ffffffff945a0165
[    3.278436] Call Trace:
[    3.278528]  [&lt;ffffffff94bbc6c1&gt;] dump_stack+0x65/0x84
[    3.278797]  [&lt;ffffffff9459fec1&gt;] kasan_object_err+0x21/0x70
[    3.279063] device: 'psaux': device_add
[    3.279616]  [&lt;ffffffff945a0165&gt;] kasan_report_error+0x205/0x500
[    3.279651] PM: Adding info for No Bus:psaux
[    3.280202]  [&lt;ffffffff944ecd22&gt;] ? kfree_const+0x22/0x30
[    3.280486]  [&lt;ffffffff94bc2dc9&gt;] ? kobject_release+0x119/0x370
[    3.280805]  [&lt;ffffffff945a0543&gt;] __asan_report_load4_noabort+0x43/0x50
[    3.281170]  [&lt;ffffffff9507e1f7&gt;] ? __scsi_scan_target+0xd87/0xdf0
[    3.281506]  [&lt;ffffffff9507e1f7&gt;] __scsi_scan_target+0xd87/0xdf0
[    3.281848]  [&lt;ffffffff9507d470&gt;] ? scsi_add_device+0x30/0x30
[    3.282156]  [&lt;ffffffff94f7f660&gt;] ? pm_runtime_autosuspend_expiration+0x60/0x60
[    3.282570]  [&lt;ffffffff956ddb07&gt;] ? _raw_spin_lock+0x17/0x40
[    3.282880]  [&lt;ffffffff9507e505&gt;] scsi_scan_channel+0x105/0x160
[    3.283200]  [&lt;ffffffff9507e8a2&gt;] scsi_scan_host_selected+0x212/0x2f0
[    3.283563]  [&lt;ffffffff9507eb3c&gt;] do_scsi_scan_host+0x1bc/0x250
[    3.283882]  [&lt;ffffffff9507efc1&gt;] do_scan_async+0x41/0x450
[    3.284173]  [&lt;ffffffff941c1fee&gt;] async_run_entry_fn+0xfe/0x610
[    3.284492]  [&lt;ffffffff941a8954&gt;] ? pwq_dec_nr_in_flight+0x124/0x2a0
[    3.284876]  [&lt;ffffffff941d1770&gt;] ? preempt_count_add+0x130/0x160
[    3.285207]  [&lt;ffffffff941a9a84&gt;] process_one_work+0x544/0x12d0
[    3.285526]  [&lt;ffffffff941aa8e9&gt;] worker_thread+0xd9/0x12f0
[    3.285844]  [&lt;ffffffff941aa810&gt;] ? process_one_work+0x12d0/0x12d0
[    3.286182]  [&lt;ffffffff941bb365&gt;] kthread+0x1c5/0x260
[    3.286443]  [&lt;ffffffff940855cd&gt;] ? __switch_to+0x88d/0x1430
[    3.286745]  [&lt;ffffffff941bb1a0&gt;] ? kthread_worker_fn+0x5a0/0x5a0
[    3.287085]  [&lt;ffffffff956dde9f&gt;] ret_from_fork+0x1f/0x40
[    3.287368]  [&lt;ffffffff941bb1a0&gt;] ? kthread_worker_fn+0x5a0/0x5a0
[    3.287697] Object at ffff880254d8bb80, in cache kmalloc-2048 size: 2048
[    3.288064] Allocated:
[    3.288147] PID = 27
[    3.288218]  [&lt;ffffffff940b27ab&gt;] save_stack_trace+0x2b/0x50
[    3.288531]  [&lt;ffffffff9459f246&gt;] save_stack+0x46/0xd0
[    3.288806]  [&lt;ffffffff9459f4bd&gt;] kasan_kmalloc+0xad/0xe0
[    3.289098]  [&lt;ffffffff9459c07e&gt;] __kmalloc+0x13e/0x250
[    3.289378]  [&lt;ffffffff95078e5a&gt;] scsi_alloc_sdev+0xea/0xcf0
[    3.289701]  [&lt;ffffffff9507de76&gt;] __scsi_scan_target+0xa06/0xdf0
[    3.290034]  [&lt;ffffffff9507e505&gt;] scsi_scan_channel+0x105/0x160
[    3.290362]  [&lt;ffffffff9507e8a2&gt;] scsi_scan_host_selected+0x212/0x2f0
[    3.290724]  [&lt;ffffffff9507eb3c&gt;] do_scsi_scan_host+0x1bc/0x250
[    3.291055]  [&lt;ffffffff9507efc1&gt;] do_scan_async+0x41/0x450
[    3.291354]  [&lt;ffffffff941c1fee&gt;] async_run_entry_fn+0xfe/0x610
[    3.291695]  [&lt;ffffffff941a9a84&gt;] process_one_work+0x544/0x12d0
[    3.292022]  [&lt;ffffffff941aa8e9&gt;] worker_thread+0xd9/0x12f0
[    3.292325]  [&lt;ffffffff941bb365&gt;] kthread+0x1c5/0x260
[    3.292594]  [&lt;ffffffff956dde9f&gt;] ret_from_fork+0x1f/0x40
[    3.292886] Freed:
[    3.292945] PID = 27
[    3.293016]  [&lt;ffffffff940b27ab&gt;] save_stack_trace+0x2b/0x50
[    3.293327]  [&lt;ffffffff9459f246&gt;] save_stack+0x46/0xd0
[    3.293600]  [&lt;ffffffff9459fa61&gt;] kasan_slab_free+0x71/0xb0
[    3.293916]  [&lt;ffffffff9459bac2&gt;] kfree+0xa2/0x1f0
[    3.294168]  [&lt;ffffffff9508158a&gt;] scsi_device_dev_release_usercontext+0x50a/0x730
[    3.294598]  [&lt;ffffffff941ace9a&gt;] execute_in_process_context+0xda/0x130
[    3.294974]  [&lt;ffffffff9508107c&gt;] scsi_device_dev_release+0x1c/0x20
[    3.295322]  [&lt;ffffffff94f566f6&gt;] device_release+0x76/0x1e0
[    3.295626]  [&lt;ffffffff94bc2db7&gt;] kobject_release+0x107/0x370
[    3.295942]  [&lt;ffffffff94bc29ce&gt;] kobject_put+0x4e/0xa0
[    3.296222]  [&lt;ffffffff94f56e17&gt;] put_device+0x17/0x20
[    3.296497]  [&lt;ffffffff9505201c&gt;] scsi_device_put+0x7c/0xa0
[    3.296801]  [&lt;ffffffff9507e1bc&gt;] __scsi_scan_target+0xd4c/0xdf0
[    3.297132]  [&lt;ffffffff9507e505&gt;] scsi_scan_channel+0x105/0x160
[    3.297458]  [&lt;ffffffff9507e8a2&gt;] scsi_scan_host_selected+0x212/0x2f0
[    3.297829]  [&lt;ffffffff9507eb3c&gt;] do_scsi_scan_host+0x1bc/0x250
[    3.298156]  [&lt;ffffffff9507efc1&gt;] do_scan_async+0x41/0x450
[    3.298453]  [&lt;ffffffff941c1fee&gt;] async_run_entry_fn+0xfe/0x610
[    3.298777]  [&lt;ffffffff941a9a84&gt;] process_one_work+0x544/0x12d0
[    3.299105]  [&lt;ffffffff941aa8e9&gt;] worker_thread+0xd9/0x12f0
[    3.299408]  [&lt;ffffffff941bb365&gt;] kthread+0x1c5/0x260
[    3.299676]  [&lt;ffffffff956dde9f&gt;] ret_from_fork+0x1f/0x40
[    3.299967] Memory state around the buggy address:
[    3.300209]  ffff880254d8c200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[    3.300608]  ffff880254d8c280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[    3.300986] &gt;ffff880254d8c300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[    3.301408]                    ^
[    3.301550]  ffff880254d8c380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[    3.301987]  ffff880254d8c400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[    3.302396]
==================================================================

Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Ming Lei &lt;tom.leiming@gmail.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.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;

</pre>
</div>
</content>
</entry>
<entry>
<title>scsi: ibmvfc: Fix I/O hang when port is not mapped</title>
<updated>2016-10-22T10:26:56+00:00</updated>
<author>
<name>Brian King</name>
<email>brking@linux.vnet.ibm.com</email>
</author>
<published>2016-09-19T13:59:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=2ed1b50a40e6d023e91a7a7d2cdb4b1247d8cec3'/>
<id>2ed1b50a40e6d023e91a7a7d2cdb4b1247d8cec3</id>
<content type='text'>
commit 07d0e9a847401ffd2f09bd450d41644cd090e81d upstream.

If a VFC port gets unmapped in the VIOS, it may not respond with a CRQ
init complete following H_REG_CRQ. If this occurs, we can end up having
called scsi_block_requests and not a resulting unblock until the init
complete happens, which may never occur, and we end up hanging I/O
requests.  This patch ensures the host action stay set to
IBMVFC_HOST_ACTION_TGT_DEL so we move all rports into devloss state and
unblock unless we receive an init complete.

Signed-off-by: Brian King &lt;brking@linux.vnet.ibm.com&gt;
Acked-by: Tyrel Datwyler &lt;tyreld@linux.vnet.ibm.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 07d0e9a847401ffd2f09bd450d41644cd090e81d upstream.

If a VFC port gets unmapped in the VIOS, it may not respond with a CRQ
init complete following H_REG_CRQ. If this occurs, we can end up having
called scsi_block_requests and not a resulting unblock until the init
complete happens, which may never occur, and we end up hanging I/O
requests.  This patch ensures the host action stay set to
IBMVFC_HOST_ACTION_TGT_DEL so we move all rports into devloss state and
unblock unless we receive an init complete.

Signed-off-by: Brian King &lt;brking@linux.vnet.ibm.com&gt;
Acked-by: Tyrel Datwyler &lt;tyreld@linux.vnet.ibm.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;

</pre>
</div>
</content>
</entry>
<entry>
<title>scsi: arcmsr: Simplify user_len checking</title>
<updated>2016-10-22T10:26:56+00:00</updated>
<author>
<name>Borislav Petkov</name>
<email>bp@alien8.de</email>
</author>
<published>2016-09-23T11:22:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=161cbfec102b846247b23d4addb22ae597fa5b88'/>
<id>161cbfec102b846247b23d4addb22ae597fa5b88</id>
<content type='text'>
commit 4bd173c30792791a6daca8c64793ec0a4ae8324f upstream.

Do the user_len check first and then the ver_addr allocation so that we
can save us the kfree() on the error path when user_len is &gt;
ARCMSR_API_DATA_BUFLEN.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: Marco Grassi &lt;marco.gra@gmail.com&gt;
Cc: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: Tomas Henzl &lt;thenzl@redhat.com&gt;
Cc: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Reviewed-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Reviewed-by: Tomas Henzl &lt;thenzl@redhat.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 4bd173c30792791a6daca8c64793ec0a4ae8324f upstream.

Do the user_len check first and then the ver_addr allocation so that we
can save us the kfree() on the error path when user_len is &gt;
ARCMSR_API_DATA_BUFLEN.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: Marco Grassi &lt;marco.gra@gmail.com&gt;
Cc: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: Tomas Henzl &lt;thenzl@redhat.com&gt;
Cc: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Reviewed-by: Johannes Thumshirn &lt;jthumshirn@suse.de&gt;
Reviewed-by: Tomas Henzl &lt;thenzl@redhat.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;

</pre>
</div>
</content>
</entry>
<entry>
<title>scsi: arcmsr: Buffer overflow in arcmsr_iop_message_xfer()</title>
<updated>2016-10-22T10:26:55+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2016-09-15T13:44:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=24040922827859d1d69597c3bc0c31fad523fd21'/>
<id>24040922827859d1d69597c3bc0c31fad523fd21</id>
<content type='text'>
commit 7bc2b55a5c030685b399bb65b6baa9ccc3d1f167 upstream.

We need to put an upper bound on "user_len" so the memcpy() doesn't
overflow.

Reported-by: Marco Grassi &lt;marco.gra@gmail.com&gt;
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Reviewed-by: Tomas Henzl &lt;thenzl@redhat.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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 7bc2b55a5c030685b399bb65b6baa9ccc3d1f167 upstream.

We need to put an upper bound on "user_len" so the memcpy() doesn't
overflow.

Reported-by: Marco Grassi &lt;marco.gra@gmail.com&gt;
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Reviewed-by: Tomas Henzl &lt;thenzl@redhat.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;

</pre>
</div>
</content>
</entry>
</feed>
