lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <48055609.3020403@gmail.com>
Date:	Wed, 16 Apr 2008 10:27:37 +0900
From:	Tejun Heo <htejun@...il.com>
To:	Paul Collins <paul@...ly.ondioline.org>
CC:	Jeff Garzik <jeff@...zik.org>, linux-kernel@...r.kernel.org
Subject: [PATCH #upstream-fixes] libata: force hardreset if the link is in
 powersave mode

Currently, libata doesn't support link powersave modes and always
disables link PS modes.  However, if the link is already in powersave
mode when libata begis probing, inhibiting powersave modes by setting
IPM isn't enough.  Link should be manually transited into active mode
using SPM or hardreset.

As SPM isn't avalable on all controllers and we're gonna prefer
hardreset in future anyway, force hardreset if link is in powersave
mode.

Reported-by: Paul Collins <paul@...ly.ondioline.org>
Signed-off-by: Tejun Heo <htejun@...il.com>
---
Jeff, this isn't necessary for #upstream.

 drivers/ata/libata-core.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

index be95fdb..e3ddefd 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3966,11 +3966,26 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
 
 	/* if SATA, resume link */
 	if (ap->flags & ATA_FLAG_SATA) {
+		u32 sstatus;
+
 		rc = sata_link_resume(link, timing, deadline);
 		/* whine about phy resume failure but proceed */
 		if (rc && rc != -EOPNOTSUPP)
 			ata_link_printk(link, KERN_WARNING, "failed to resume "
 					"link for reset (errno=%d)\n", rc);
+
+		/* force hardreset if the link is sleeping */
+		if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) {
+			u8 ipm = sstatus >> 8;
+
+			if (ipm == 2 || ipm == 6) {
+				ata_link_printk(link, KERN_INFO,
+					"link in %s mode, forcing hardreset\n",
+					ipm == 2 ? "partial" : "slumber");
+				ehc->i.action |= ATA_EH_HARDRESET;
+				return 0;
+			}
+		}
 	}
 
 	/* Wait for !BSY if the controller can wait for the first D2H
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ