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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 25 Feb 2022 12:10:30 -0600
From:   Mario Limonciello <mario.limonciello@....com>
To:     Damien Le Moal <damien.lemoal@...nsource.wdc.com>
CC:     "open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers)" 
        <linux-ide@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        <hdegoede@...hat.com>,
        Mario Limonciello <mario.limonciello@....com>
Subject: [RFC 2/2] ata: ahci: Protect users from setting policies their drives don't support

As the default low power policy applies to more chipsets and drives, it's
important to make sure that drives actually support the policy that a user
selected in their kernel configuration.

If the drive doesn't support slumber, don't let the default policy for the
ATA port be `min_power` or `min_power_with_partial`.

Signed-off-by: Mario Limonciello <mario.limonciello@....com>
---
 drivers/ata/ahci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 17d757ad7111..af8999453084 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1584,8 +1584,16 @@ static int ahci_init_msi(struct pci_dev *pdev, unsigned int n_ports,
 static void ahci_update_initial_lpm_policy(struct ata_port *ap,
 					   struct ahci_host_priv *hpriv)
 {
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
 	int policy = CONFIG_SATA_LPM_POLICY;
 
+	if (policy >= ATA_LPM_MIN_POWER_WITH_PARTIAL &&
+	   !(hpriv->cap & HOST_CAP_SSC)) {
+		dev_warn(&pdev->dev,
+			 "This drive doesn't support slumber; ignoring default SATA policy\n");
+		return;
+	}
+
 	/* user modified policy via module param */
 	if (mobile_lpm_policy != -1) {
 		policy = mobile_lpm_policy;
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ