]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ahci: fix hang on failed softreset
authorTejun Heo <tj@kernel.org>
Fri, 27 Aug 2010 09:09:15 +0000 (11:09 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Sep 2010 20:36:32 +0000 (13:36 -0700)
commit2b88bc4f87ca83631af8ab3286964a547835a0df
tree8ccc9e07f0728a255e4fc40c11a345c1508fe6ae
parent63b754139e3c4b1e24e0e488a7864b136738032f
ahci: fix hang on failed softreset

commit f1f5a807b051eddd3f302e503d39214e5bde0ef2 upstream.

ahci_do_softreset() compared the current time and deadline in reverse
when calculating timeout for SRST issue.  The result is that if
@deadline is in future, SRST is issued with 0 timeout, which hasn't
caused any problem because it later waits for DRDY with the correct
timeout.  If deadline is already exceeded by the time SRST is about to
be issued, the timeout calculation underflows and if the device
doesn't respond, timeout doesn't trigger for a _very_ long time.

Reverse the incorrect comparison order.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Gwendal Grignou <gwendal@google.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/ata/libahci.c