Re: [PATCH v2 1/2] ata: libata-core: Skip HPA resize for locked drives
From: Damien Le Moal
Date: Tue Jul 07 2026 - 02:05:02 EST
On 7/7/26 06:00, TJ Adams wrote:
> 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.
>
> Signed-off-by: Terrence Adams <tadamsjr@xxxxxxxxxx>
Doesn't this need the same fixes tag as patch 2 ?
> ---
> drivers/ata/libata-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index bdc88cf74709..3c06a15952f8 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -1338,7 +1338,7 @@ static int ata_hpa_resize(struct ata_device *dev)
> /* do we need to do it? */
> if ((dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ZAC) ||
> !ata_id_has_lba(dev->id) || !ata_id_hpa_enabled(dev->id) ||
> - (dev->quirks & ATA_QUIRK_BROKEN_HPA))
> + (dev->quirks & ATA_QUIRK_BROKEN_HPA) || ata_id_is_locked(dev->id))
> return 0;
>
> /* read native max address */
--
Damien Le Moal
Western Digital Research