• Tejun Heo's avatar
    ahci: fix hang on failed softreset · f1f5a807
    Tejun Heo authored
    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: default avatarTejun Heo <tj@kernel.org>
    Reported-by: default avatarAnssi Hannula <anssi.hannula@iki.fi>
    Tested-by: default avatarGwendal Grignou <gwendal@google.com>
    Cc: stable@kernel.org
    Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
    f1f5a807
libahci.c 56.5 KB