Skip to content

Commit 917d0a4

Browse files
TJ Adamsdamien-lemoal
authored andcommitted
ata: libata-core: Skip HPA resize for locked drives
Skip HPA resize in ata_hpa_resize() if the drive is security locked. If the drive is locked, the command to read the native max address fails with -EACCES, which currently causes the sticky quirk ATA_QUIRK_BROKEN_HPA to be set on the device. Setting this sticky quirk causes subsequent revalidations (after the drive is unlocked) to bypass HPA checks, preventing the unlocked drive from exposing its full native capacity without a reboot or device removal. Cc: stable@vger.kernel.org Signed-off-by: Terrence Adams <tadamsjr@google.com> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
1 parent cd64be0 commit 917d0a4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/ata/libata-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ static int ata_hpa_resize(struct ata_device *dev)
13381338
/* do we need to do it? */
13391339
if ((dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ZAC) ||
13401340
!ata_id_has_lba(dev->id) || !ata_id_hpa_enabled(dev->id) ||
1341-
(dev->quirks & ATA_QUIRK_BROKEN_HPA))
1341+
(dev->quirks & ATA_QUIRK_BROKEN_HPA) || ata_id_is_locked(dev->id))
13421342
return 0;
13431343

13441344
/* read native max address */

0 commit comments

Comments
 (0)