<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/scsi, branch v4.8.6</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>mpt3sas: Don't spam logs if logging level is 0</title>
<updated>2016-10-31T11:02:14+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=d7baac249b8309948ccfe12ad104fb14982c9692'/>
<id>d7baac249b8309948ccfe12ad104fb14982c9692</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>scsi: cxlflash: Remove the device cleanly in the system shutdown path</title>
<updated>2016-10-31T11:02:08+00:00</updated>
<author>
<name>Uma Krishnan</name>
<email>ukrishn@linux.vnet.ibm.com</email>
</author>
<published>2016-09-02T20:39:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=17fdf0c304fddf0fc4369a54f17f8de148f3688b'/>
<id>17fdf0c304fddf0fc4369a54f17f8de148f3688b</id>
<content type='text'>
commit babf985d1e1b0677cb264acd01319d2b9c8f4327 upstream.

Commit 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash
cards") was recently introduced to notify the AFU when a system is going
down. Due to the position of the cxlflash driver in the device stack,
cxlflash devices are _always_ removed during a reboot/shutdown. This can
lead to a crash if the cxlflash shutdown hook is invoked _after_ the
shutdown hook for the owning virtual PHB. Furthermore, the current
implementation of shutdown/remove hooks for cxlflash are not tolerant to
being invoked when the device is not enabled. This can also lead to a
crash in situations where the remove hook is invoked after the device
has been removed via the vPHBs shutdown hook. An example of this
scenario would be an EEH reset failure while a reboot/shutdown is in
progress.

To solve both problems, the shutdown hook for cxlflash is updated to
simply remove the device. This path already includes the AFU
notification and thus this solution will continue to perform the
original intent. At the same time, the remove hook is updated to protect
against being called when the device is not enabled.

Fixes: 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash
cards")
Signed-off-by: Uma Krishnan &lt;ukrishn@linux.vnet.ibm.com&gt;
Acked-by: Matthew R. Ochs &lt;mrochs@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 babf985d1e1b0677cb264acd01319d2b9c8f4327 upstream.

Commit 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash
cards") was recently introduced to notify the AFU when a system is going
down. Due to the position of the cxlflash driver in the device stack,
cxlflash devices are _always_ removed during a reboot/shutdown. This can
lead to a crash if the cxlflash shutdown hook is invoked _after_ the
shutdown hook for the owning virtual PHB. Furthermore, the current
implementation of shutdown/remove hooks for cxlflash are not tolerant to
being invoked when the device is not enabled. This can also lead to a
crash in situations where the remove hook is invoked after the device
has been removed via the vPHBs shutdown hook. An example of this
scenario would be an EEH reset failure while a reboot/shutdown is in
progress.

To solve both problems, the shutdown hook for cxlflash is updated to
simply remove the device. This path already includes the AFU
notification and thus this solution will continue to perform the
original intent. At the same time, the remove hook is updated to protect
against being called when the device is not enabled.

Fixes: 704c4b0ddc03 ("cxlflash: Shutdown notify support for CXL Flash
cards")
Signed-off-by: Uma Krishnan &lt;ukrishn@linux.vnet.ibm.com&gt;
Acked-by: Matthew R. Ochs &lt;mrochs@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: Fix use-after-free</title>
<updated>2016-10-28T07:45:26+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=8bfe1c78242a333a78674e4bda6e5040ae0b048c'/>
<id>8bfe1c78242a333a78674e4bda6e5040ae0b048c</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:40:24+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=f653028e3671c61491c923d1f5e2790a6727b88b'/>
<id>f653028e3671c61491c923d1f5e2790a6727b88b</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:40:24+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=0f247610278aa37d8a6a24646683b85b81c7bf3d'/>
<id>0f247610278aa37d8a6a24646683b85b81c7bf3d</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:40:24+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=cf4dc8d4d44078c0c9063df957caad12c79d79b3'/>
<id>cf4dc8d4d44078c0c9063df957caad12c79d79b3</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>
<entry>
<title>scsi: configure runtime pm before calling device_add in scsi_add_host_with_dma</title>
<updated>2016-10-20T08:03:30+00:00</updated>
<author>
<name>Heiner Kallweit</name>
<email>hkallweit1@gmail.com</email>
</author>
<published>2016-08-03T19:49:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8523011cec401fcf524cff3b8119ab2fa5c9ac0f'/>
<id>8523011cec401fcf524cff3b8119ab2fa5c9ac0f</id>
<content type='text'>
commit 0d5644b7d8daa3c1d91acb4367731f568c9c9469 upstream.

Runtime PM should be configured already once we call device_add. See
also the description in this mail thread
https://lists.linuxfoundation.org/pipermail/linux-pm/2009-November/023198.html
or the order of calls e.g. in usb_new_device.

The changed order also helps to avoid scenarios where runtime pm for
&amp;shost-&gt;shost_gendev is activated whilst the parent is suspended,
resulting in error message "runtime PM trying to activate child device
hostx but parent yyy is not active".

In addition properly reverse the runtime pm calls in the error path.

Signed-off-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&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 0d5644b7d8daa3c1d91acb4367731f568c9c9469 upstream.

Runtime PM should be configured already once we call device_add. See
also the description in this mail thread
https://lists.linuxfoundation.org/pipermail/linux-pm/2009-November/023198.html
or the order of calls e.g. in usb_new_device.

The changed order also helps to avoid scenarios where runtime pm for
&amp;shost-&gt;shost_gendev is activated whilst the parent is suspended,
resulting in error message "runtime PM trying to activate child device
hostx but parent yyy is not active".

In addition properly reverse the runtime pm calls in the error path.

Signed-off-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&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>Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi</title>
<updated>2016-10-01T14:37:15+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-10-01T14:37:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f51fdffad5b7709d0ade40736b58a2da2707fa15'/>
<id>f51fdffad5b7709d0ade40736b58a2da2707fa15</id>
<content type='text'>
Pull SCSI fix from James Bottomley:
 "One final fix before 4.8.

  There was a memory leak triggered by turning scsi mq off due to the
  fact that we assume on host release that the already running hosts
  weren't mq based because that's the state of the global flag (even
  though they were).

  Fix it by tracking this on a per host host basis"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: Avoid that toggling use_blk_mq triggers a memory leak
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull SCSI fix from James Bottomley:
 "One final fix before 4.8.

  There was a memory leak triggered by turning scsi mq off due to the
  fact that we assume on host release that the already running hosts
  weren't mq based because that's the state of the global flag (even
  though they were).

  Fix it by tracking this on a per host host basis"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: Avoid that toggling use_blk_mq triggers a memory leak
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'mkp-scsi/4.8/scsi-fixes' into fixes</title>
<updated>2016-09-28T05:30:51+00:00</updated>
<author>
<name>James Bottomley</name>
<email>James.Bottomley@HansenPartnership.com</email>
</author>
<published>2016-09-28T05:30:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=539294b76af8922297702a7ebb8cafe68f7e5376'/>
<id>539294b76af8922297702a7ebb8cafe68f7e5376</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>scsi: Avoid that toggling use_blk_mq triggers a memory leak</title>
<updated>2016-09-27T00:58:42+00:00</updated>
<author>
<name>Bart Van Assche</name>
<email>bart.vanassche@sandisk.com</email>
</author>
<published>2016-09-22T21:20:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8d58881b995904bf8b150dae69be0829f832e7be'/>
<id>8d58881b995904bf8b150dae69be0829f832e7be</id>
<content type='text'>
This patch avoids that the following memory leak is triggered if
use_blk_mq is disabled after a SCSI host has been allocated by the
ib_srp driver and before the same SCSI host is freed:

unreferenced object 0xffff8803a168c568 (size 256):
  backtrace:
    [&lt;ffffffff81620c95&gt;] kmemleak_alloc+0x45/0xa0
    [&lt;ffffffff811bb104&gt;] __kmalloc_node+0x1e4/0x400
    [&lt;ffffffff81309fe4&gt;] blk_mq_alloc_tag_set+0xb4/0x230
    [&lt;ffffffff814731b7&gt;] scsi_mq_setup_tags+0xc7/0xd0
    [&lt;ffffffff81469c26&gt;] scsi_add_host_with_dma+0x216/0x2d0
    [&lt;ffffffffa064bef5&gt;] srp_create_target+0xe55/0x13d0 [ib_srp]
    [&lt;ffffffff8143ce23&gt;] dev_attr_store+0x13/0x20
    [&lt;ffffffff8125f030&gt;] sysfs_kf_write+0x40/0x50
    [&lt;ffffffff8125e397&gt;] kernfs_fop_write+0x137/0x1c0
    [&lt;ffffffff811d8c13&gt;] __vfs_write+0x23/0x140
    [&lt;ffffffff811d92e0&gt;] vfs_write+0xb0/0x190
    [&lt;ffffffff811da5b4&gt;] SyS_write+0x44/0xa0
    [&lt;ffffffff8162c8a5&gt;] entry_SYSCALL_64_fastpath+0x18/0xa8

Fixes: 9aa9cc4221f5 ("scsi: remove the disable_blk_mq host flag")
Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch avoids that the following memory leak is triggered if
use_blk_mq is disabled after a SCSI host has been allocated by the
ib_srp driver and before the same SCSI host is freed:

unreferenced object 0xffff8803a168c568 (size 256):
  backtrace:
    [&lt;ffffffff81620c95&gt;] kmemleak_alloc+0x45/0xa0
    [&lt;ffffffff811bb104&gt;] __kmalloc_node+0x1e4/0x400
    [&lt;ffffffff81309fe4&gt;] blk_mq_alloc_tag_set+0xb4/0x230
    [&lt;ffffffff814731b7&gt;] scsi_mq_setup_tags+0xc7/0xd0
    [&lt;ffffffff81469c26&gt;] scsi_add_host_with_dma+0x216/0x2d0
    [&lt;ffffffffa064bef5&gt;] srp_create_target+0xe55/0x13d0 [ib_srp]
    [&lt;ffffffff8143ce23&gt;] dev_attr_store+0x13/0x20
    [&lt;ffffffff8125f030&gt;] sysfs_kf_write+0x40/0x50
    [&lt;ffffffff8125e397&gt;] kernfs_fop_write+0x137/0x1c0
    [&lt;ffffffff811d8c13&gt;] __vfs_write+0x23/0x140
    [&lt;ffffffff811d92e0&gt;] vfs_write+0xb0/0x190
    [&lt;ffffffff811da5b4&gt;] SyS_write+0x44/0xa0
    [&lt;ffffffff8162c8a5&gt;] entry_SYSCALL_64_fastpath+0x18/0xa8

Fixes: 9aa9cc4221f5 ("scsi: remove the disable_blk_mq host flag")
Signed-off-by: Bart Van Assche &lt;bart.vanassche@sandisk.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
