]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ata: libata-sata: fix ata_scsi_lpm_supported() iteration
authorNiklas Cassel <cassel@kernel.org>
Tue, 28 Jul 2026 11:38:42 +0000 (13:38 +0200)
committerDamien Le Moal <dlemoal@kernel.org>
Wed, 29 Jul 2026 01:55:11 +0000 (10:55 +0900)
The inner loop of ata_scsi_lpm_supported() uses the wrong variable when
iterating.

It should obviously use the link that we are currently iterating over,
rather than always using the host link.

ata_scsi_lpm_supported() is used to control if a user should be allowed
to change lpm policy (from the default) via sysfs.

Thus, this bug could potentially disallow users to change the LPM policy
for certain SATA devices via sysfs.

Cc: stable@vger.kernel.org
Fixes: 0060beec0bfa ("ata: libata-sata: Add link_power_management_supported sysfs attribute")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://lore.kernel.org/linux-ide/20260728112200.B99F21F000E9@smtp.kernel.org/
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
drivers/ata/libata-sata.c

index b0706c30da052c9e8b4bd0bdb107a8778cafd482..ad40f516c6d4350e5bbc9376266998b8c56946cb 100644 (file)
@@ -913,7 +913,7 @@ static bool ata_scsi_lpm_supported(struct ata_port *ap)
                return false;
 
        ata_for_each_link(link, ap, EDGE) {
-               ata_for_each_dev(dev, &ap->link, ENABLED) {
+               ata_for_each_dev(dev, link, ENABLED) {
                        if (dev->quirks & ATA_QUIRK_NOLPM)
                                return false;
                }