<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/ata, branch v3.18.67</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.18.67</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.18.67'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-08-11T16:30:13Z</updated>
<entry>
<title>libata: array underflow in ata_find_dev()</title>
<updated>2017-08-11T16:30:13Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2017-07-19T10:06:41Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=715ad0f174e25074e1a6178d9dbef7bb27e7b326'/>
<id>urn:sha1:715ad0f174e25074e1a6178d9dbef7bb27e7b326</id>
<content type='text'>
commit 59a5e266c3f5c1567508888dd61a45b86daed0fa upstream.

My static checker complains that "devno" can be negative, meaning that
we read before the start of the loop.  I've looked at the code, and I
think the warning is right.  This come from /proc so it's root only or
it would be quite a quite a serious bug.  The call tree looks like this:

proc_scsi_write() &lt;- gets id and channel from simple_strtoul()
-&gt; scsi_add_single_device() &lt;- calls shost-&gt;transportt-&gt;user_scan()
   -&gt; ata_scsi_user_scan()
      -&gt; ata_find_dev()

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>ata: hpt366: fix constant cast warning</title>
<updated>2017-02-08T08:43:03Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2015-05-19T14:34:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8b367e00da604df489c8574bb1e21fab5bda29f3'/>
<id>urn:sha1:8b367e00da604df489c8574bb1e21fab5bda29f3</id>
<content type='text'>
commit 6ec0a86c645be3fce7ade42f165a6a417c3503b1 upstream.

gcc-5.x warns about a preexisting problem in the hpt36x pata driver:

drivers/ata/pata_hpt366.c: In function 'hpt36x_init_one':
drivers/ata/pata_hpt366.c:376:9: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]

Other ata drivers have the same problem, as ata_pci_bmdma_init_one
takes a non-const pointer, and they solve it by using a cast to
turn that pointer into a normal non-const pointer.

I also tried to change the ata core code to make host-&gt;private_data
a const pointer, but that quickly got out of hand, as some other
drivers expect it to be writable, so I ended up using the same
hack as the others here.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Acked-by: Bartlomiej Zolnierkiewicz &lt;b.zolnierkie@samsung.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>scsi: fix race between simultaneous decrements of -&gt;host_failed</title>
<updated>2016-07-11T15:10:54Z</updated>
<author>
<name>Wei Fang</name>
<email>fangwei1@huawei.com</email>
</author>
<published>2016-06-07T06:53:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d6e98a6fc83d19ad85f52cad0111b047e51e61a9'/>
<id>urn:sha1:d6e98a6fc83d19ad85f52cad0111b047e51e61a9</id>
<content type='text'>
[ Upstream commit 72d8c36ec364c82bf1bf0c64dfa1041cfaf139f7 ]

sas_ata_strategy_handler() adds the works of the ata error handler to
system_unbound_wq. This workqueue asynchronously runs work items, so the
ata error handler will be performed concurrently on different CPUs. In
this case, -&gt;host_failed will be decreased simultaneously in
scsi_eh_finish_cmd() on different CPUs, and become abnormal.

It will lead to permanently inequality between -&gt;host_failed and
-&gt;host_busy, and scsi error handler thread won't start running. IO
errors after that won't be handled.

Since all scmds must have been handled in the strategy handler, just
remove the decrement in scsi_eh_finish_cmd() and zero -&gt;host_busy after
the strategy handler to fix this race.

Fixes: 50824d6c5657 ("[SCSI] libsas: async ata-eh")
Cc: stable@vger.kernel.org
Signed-off-by: Wei Fang &lt;fangwei1@huawei.com&gt;
Reviewed-by: James Bottomley &lt;jejb@linux.vnet.ibm.com&gt;
Signed-off-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>ata: ahci-platform: Add ports-implemented DT bindings.</title>
<updated>2016-05-17T18:31:17Z</updated>
<author>
<name>Srinivas Kandagatla</name>
<email>srinivas.kandagatla@linaro.org</email>
</author>
<published>2016-04-01T07:52:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f9133a946b21af76708e868eb299f1f26ec82e61'/>
<id>urn:sha1:f9133a946b21af76708e868eb299f1f26ec82e61</id>
<content type='text'>
[ Upstream commit 17dcc37e3e847bc0e67a5b1ec52471fcc6c18682 ]

On some SOCs PORTS_IMPL register value is never programmed by the
firmware and left at zero value. Which means that no sata ports are
available for software. AHCI driver used to cope up with this by
fabricating the port_map if the PORTS_IMPL register is read zero,
but recent patch broke this workaround as zero value was valid for
NVMe disks.

This patch adds ports-implemented DT bindings as workaround for this issue
in a way that DT can can override the PORTS_IMPL register in cases where
the firmware did not program it already.

Fixes: 566d1827df2e ("libata: disable forced PORTS_IMPL for &gt;= AHCI 1.3")
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Srinivas Kandagatla &lt;srinivas.kandagatla@linaro.org&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Reviewed-by: Andy Gross &lt;andy.gross@linaro.org&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>libahci: save port map for forced port map</title>
<updated>2016-05-17T18:31:09Z</updated>
<author>
<name>Srinivas Kandagatla</name>
<email>srinivas.kandagatla@linaro.org</email>
</author>
<published>2016-04-01T07:52:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=743f6ef19cd84b28f02c2fc60db6a046730c1a52'/>
<id>urn:sha1:743f6ef19cd84b28f02c2fc60db6a046730c1a52</id>
<content type='text'>
[ Upstream commit 2fd0f46cb1b82587c7ae4a616d69057fb9bd0af7 ]

In usecases where force_port_map is used saved_port_map is never set,
resulting in not programming the PORTS_IMPL register as part of initial
config. This patch fixes this by setting it to port_map even in case
where force_port_map is used, making it more inline with other parts of
the code.

Fixes: 566d1827df2e ("libata: disable forced PORTS_IMPL for &gt;= AHCI 1.3")
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Srinivas Kandagatla &lt;srinivas.kandagatla@linaro.org&gt;
Acked-by: Tejun Heo &lt;tj@kernel.org&gt;
Reviewed-by: Andy Gross &lt;andy.gross@linaro.org&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>Adding Intel Lewisburg device IDs for SATA</title>
<updated>2016-03-08T02:29:57Z</updated>
<author>
<name>Alexandra Yates</name>
<email>alexandra.yates@linux.intel.com</email>
</author>
<published>2016-02-18T03:36:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0b17b1b036503671b2960883c629a67d60e8c488'/>
<id>urn:sha1:0b17b1b036503671b2960883c629a67d60e8c488</id>
<content type='text'>
[ Upstream commit f5bdd66c705484b4bc77eb914be15c1b7881fae7 ]

This patch complements the list of device IDs previously
added for lewisburg sata.

Signed-off-by: Alexandra Yates &lt;alexandra.yates@linux.intel.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>ahci: Order SATA device IDs for codename Lewisburg</title>
<updated>2016-03-08T02:29:48Z</updated>
<author>
<name>Alexandra Yates</name>
<email>alexandra.yates@linux.intel.com</email>
</author>
<published>2015-11-16T16:22:16Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1c522e28c418c16df3d8d31404854355961fdd7b'/>
<id>urn:sha1:1c522e28c418c16df3d8d31404854355961fdd7b</id>
<content type='text'>
[ Upstream commit 4d92f0099a06ef0e36c7673f7c090f1a448b2d1b ]

This change was to preserve the ascending order of device IDs.
There was an exception with the first two Lewisburg device IDs to
keep all device IDs of the same kind grouped by code name.

Signed-off-by: Alexandra Yates &lt;alexandra.yates@linux.intel.com&gt;
signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>libata: fix HDIO_GET_32BIT ioctl</title>
<updated>2016-03-08T02:13:02Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2016-02-11T13:16:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6e9c571aa944bf652e64b1df8446b2010ab2a8f0'/>
<id>urn:sha1:6e9c571aa944bf652e64b1df8446b2010ab2a8f0</id>
<content type='text'>
[ Upstream commit 287e6611ab1eac76c2c5ebf6e345e04c80ca9c61 ]

As reported by Soohoon Lee, the HDIO_GET_32BIT ioctl does not
work correctly in compat mode with libata.

I have investigated the issue further and found multiple problems
that all appeared with the same commit that originally introduced
HDIO_GET_32BIT handling in libata back in linux-2.6.8 and presumably
also linux-2.4, as the code uses "copy_to_user(arg, &amp;val, 1)" to copy
a 'long' variable containing either 0 or 1 to user space.

The problems with this are:

* On big-endian machines, this will always write a zero because it
  stores the wrong byte into user space.

* In compat mode, the upper three bytes of the variable are updated
  by the compat_hdio_ioctl() function, but they now contain
  uninitialized stack data.

* The hdparm tool calling this ioctl uses a 'static long' variable
  to store the result. This means at least the upper bytes are
  initialized to zero, but calling another ioctl like HDIO_GET_MULTCOUNT
  would fill them with data that remains stale when the low byte
  is overwritten. Fortunately libata doesn't implement any of the
  affected ioctl commands, so this would only happen when we query
  both an IDE and an ATA device in the same command such as
  "hdparm -N -c /dev/hda /dev/sda"

* The libata code for unknown reasons started using ATA_IOC_GET_IO32
  and ATA_IOC_SET_IO32 as aliases for HDIO_GET_32BIT and HDIO_SET_32BIT,
  while the ioctl commands that were added later use the normal
  HDIO_* names. This is harmless but rather confusing.

This addresses all four issues by changing the code to use put_user()
on an 'unsigned long' variable in HDIO_GET_32BIT, like the IDE subsystem
does, and by clarifying the names of the ioctl commands.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Reported-by: Soohoon Lee &lt;Soohoon.Lee@f5.com&gt;
Tested-by: Soohoon Lee &lt;Soohoon.Lee@f5.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>ahci: Intel DNV device IDs SATA</title>
<updated>2016-03-04T15:18:40Z</updated>
<author>
<name>Alexandra Yates</name>
<email>alexandra.yates@linux.intel.com</email>
</author>
<published>2016-02-05T23:27:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=97e8007ccee791c1eddb3822c1597979cbe8a45e'/>
<id>urn:sha1:97e8007ccee791c1eddb3822c1597979cbe8a45e</id>
<content type='text'>
[ Upstream commit 342decff2b846b46fa61eb5ee40986fab79a9a32 ]

Adding Intel codename DNV platform device IDs for SATA.

Signed-off-by: Alexandra Yates &lt;alexandra.yates@linux.intel.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>libata: fix sff host state machine locking while polling</title>
<updated>2016-03-02T20:18:54Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2016-02-01T16:33:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=99f2717cfa1e34340b14d06a2f156fab147b5da3'/>
<id>urn:sha1:99f2717cfa1e34340b14d06a2f156fab147b5da3</id>
<content type='text'>
[ Upstream commit 8eee1d3ed5b6fc8e14389567c9a6f53f82bb7224 ]

The bulk of ATA host state machine is implemented by
ata_sff_hsm_move().  The function is called from either the interrupt
handler or, if polling, a work item.  Unlike from the interrupt path,
the polling path calls the function without holding the host lock and
ata_sff_hsm_move() selectively grabs the lock.

This is completely broken.  If an IRQ triggers while polling is in
progress, the two can easily race and end up accessing the hardware
and updating state machine state at the same time.  This can put the
state machine in an illegal state and lead to a crash like the
following.

  kernel BUG at drivers/ata/libata-sff.c:1302!
  invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN
  Modules linked in:
  CPU: 1 PID: 10679 Comm: syz-executor Not tainted 4.5.0-rc1+ #300
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
  task: ffff88002bd00000 ti: ffff88002e048000 task.ti: ffff88002e048000
  RIP: 0010:[&lt;ffffffff83a83409&gt;]  [&lt;ffffffff83a83409&gt;] ata_sff_hsm_move+0x619/0x1c60
  ...
  Call Trace:
   &lt;IRQ&gt;
   [&lt;ffffffff83a84c31&gt;] __ata_sff_port_intr+0x1e1/0x3a0 drivers/ata/libata-sff.c:1584
   [&lt;ffffffff83a85611&gt;] ata_bmdma_port_intr+0x71/0x400 drivers/ata/libata-sff.c:2877
   [&lt;     inline     &gt;] __ata_sff_interrupt drivers/ata/libata-sff.c:1629
   [&lt;ffffffff83a85bf3&gt;] ata_bmdma_interrupt+0x253/0x580 drivers/ata/libata-sff.c:2902
   [&lt;ffffffff81479f98&gt;] handle_irq_event_percpu+0x108/0x7e0 kernel/irq/handle.c:157
   [&lt;ffffffff8147a717&gt;] handle_irq_event+0xa7/0x140 kernel/irq/handle.c:205
   [&lt;ffffffff81484573&gt;] handle_edge_irq+0x1e3/0x8d0 kernel/irq/chip.c:623
   [&lt;     inline     &gt;] generic_handle_irq_desc include/linux/irqdesc.h:146
   [&lt;ffffffff811a92bc&gt;] handle_irq+0x10c/0x2a0 arch/x86/kernel/irq_64.c:78
   [&lt;ffffffff811a7e4d&gt;] do_IRQ+0x7d/0x1a0 arch/x86/kernel/irq.c:240
   [&lt;ffffffff86653d4c&gt;] common_interrupt+0x8c/0x8c arch/x86/entry/entry_64.S:520
   &lt;EOI&gt;
   [&lt;     inline     &gt;] rcu_lock_acquire include/linux/rcupdate.h:490
   [&lt;     inline     &gt;] rcu_read_lock include/linux/rcupdate.h:874
   [&lt;ffffffff8164b4a1&gt;] filemap_map_pages+0x131/0xba0 mm/filemap.c:2145
   [&lt;     inline     &gt;] do_fault_around mm/memory.c:2943
   [&lt;     inline     &gt;] do_read_fault mm/memory.c:2962
   [&lt;     inline     &gt;] do_fault mm/memory.c:3133
   [&lt;     inline     &gt;] handle_pte_fault mm/memory.c:3308
   [&lt;     inline     &gt;] __handle_mm_fault mm/memory.c:3418
   [&lt;ffffffff816efb16&gt;] handle_mm_fault+0x2516/0x49a0 mm/memory.c:3447
   [&lt;ffffffff8127dc16&gt;] __do_page_fault+0x376/0x960 arch/x86/mm/fault.c:1238
   [&lt;ffffffff8127e358&gt;] trace_do_page_fault+0xe8/0x420 arch/x86/mm/fault.c:1331
   [&lt;ffffffff8126f514&gt;] do_async_page_fault+0x14/0xd0 arch/x86/kernel/kvm.c:264
   [&lt;ffffffff86655578&gt;] async_page_fault+0x28/0x30 arch/x86/entry/entry_64.S:986

Fix it by ensuring that the polling path is holding the host lock
before entering ata_sff_hsm_move() so that all hardware accesses and
state updates are performed under the host lock.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Reported-and-tested-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Link: http://lkml.kernel.org/g/CACT4Y+b_JsOxJu2EZyEf+mOXORc_zid5V1-pLZSroJVxyWdSpw@mail.gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
</feed>
