public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <cassel@kernel.org>, Hannes Reinecke <hare@suse.de>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Ilia Baryshnikov <qwelias@gmail.com>,
	stable@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH 1/2] ata: libata-scsi: Fix system suspend for a security locked drive
Date: Thu, 20 Nov 2025 12:29:14 +0900	[thread overview]
Message-ID: <a131abb5-b79b-4a22-a768-55db348b1bde@kernel.org> (raw)
In-Reply-To: <20251119141313.2220084-3-cassel@kernel.org>

On 11/19/25 11:13 PM, Niklas Cassel wrote:
> Commit cf3fc037623c ("ata: libata-scsi: Fix ata_to_sense_error() status
> handling") fixed ata_to_sense_error() to properly generate sense key
> ABORTED COMMAND (without any additional sense code), instead of the
> previous bogus sense key ILLEGAL REQUEST with the additional sense code
> UNALIGNED WRITE COMMAND, for a failed command.
> 
> However, this broke suspend for Security locked drives (drives that have
> Security enabled, and have not been Security unlocked by boot firmware).
> 
> The reason for this is that the SCSI disk driver, for the Synchronize
> Cache command only, treats any sense data with sense key ILLEGAL REQUEST
> as a successful command (regardless of ASC / ASCQ).
> 
> After commit cf3fc037623c ("ata: libata-scsi: Fix ata_to_sense_error()
> status handling") the code that treats any sense data with sense key
> ILLEGAL REQUEST as a successful command is no longer applicable, so the
> command fails, which causes the system suspend to be aborted:
> 
>   sd 1:0:0:0: PM: dpm_run_callback(): scsi_bus_suspend returns -5
>   sd 1:0:0:0: PM: failed to suspend async: error -5
>   PM: Some devices failed to suspend, or early wake event detected
> 
> To make suspend work once again, for a Security locked device only,
> return sense data LOGICAL UNIT ACCESS NOT AUTHORIZED, the actual sense
> data which a real SCSI device would have returned if locked.
> The SCSI disk driver treats this sense data as a successful command.
> 
> Cc: stable@vger.kernel.org
> Reported-by: Ilia Baryshnikov <qwelias@gmail.com>
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220704
> Fixes: cf3fc037623c ("ata: libata-scsi: Fix ata_to_sense_error() status handling")
> Signed-off-by: Niklas Cassel <cassel@kernel.org>

I think that adding this to ata_scsi_flush_xlat() would be better, but this way
may be able to catch more cases like sync failure. So for now, let's go with this.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>


-- 
Damien Le Moal
Western Digital Research

  parent reply	other threads:[~2025-11-20  3:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 14:13 [PATCH 1/2] ata: libata-scsi: Fix system suspend for a security locked drive Niklas Cassel
2025-11-19 14:13 ` [PATCH 2/2] ata: libata-core: Set capacity to zero " Niklas Cassel
2025-11-20  3:31   ` Damien Le Moal
2025-11-20  3:49   ` Martin K. Petersen
2025-11-20  7:24   ` Hannes Reinecke
2025-11-20  3:29 ` Damien Le Moal [this message]
2025-11-20  3:48 ` [PATCH 1/2] ata: libata-scsi: Fix system suspend " Martin K. Petersen
2025-11-20  7:24 ` Hannes Reinecke
2025-11-20 12:45 ` Niklas Cassel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a131abb5-b79b-4a22-a768-55db348b1bde@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=cassel@kernel.org \
    --cc=hare@suse.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=qwelias@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox