Linux ATA/IDE development
 help / color / mirror / Atom feed
* [PATCH] ata: libata-sata: fix ata_scsi_lpm_supported() iteration
@ 2026-07-28 11:38 Niklas Cassel
  2026-07-28 11:40 ` Niklas Cassel
  2026-07-28 11:53 ` sashiko-bot
  0 siblings, 2 replies; 5+ messages in thread
From: Niklas Cassel @ 2026-07-28 11:38 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Martin K. Petersen
  Cc: stable, Sashiko, linux-ide

The inner loop of ata_scsi_lpm_supported() user 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>
---
 drivers/ata/libata-sata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
index 2ee54d60ea4b..5138b4e500e5 100644
--- a/drivers/ata/libata-sata.c
+++ b/drivers/ata/libata-sata.c
@@ -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;
 		}
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-28 12:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 11:38 [PATCH] ata: libata-sata: fix ata_scsi_lpm_supported() iteration Niklas Cassel
2026-07-28 11:40 ` Niklas Cassel
2026-07-28 11:53 ` sashiko-bot
2026-07-28 12:16   ` Niklas Cassel
2026-07-28 12:37     ` Niklas Cassel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox