public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ata: libata-scsi: report correct sense field pointer in ata_scsiop_maint_in()
@ 2026-03-20  3:48 Damien Le Moal
  2026-03-20  9:09 ` Niklas Cassel
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Le Moal @ 2026-03-20  3:48 UTC (permalink / raw)
  To: linux-ide, Niklas Cassel; +Cc: Guenter Roeck

Commit 4ab7bb976343 ("ata: libata-scsi: Refactor ata_scsiop_maint_in()")
modified ata_scsiop_maint_in() to directly call
ata_scsi_set_invalid_field() to set the field pointer of the sense data
of a failed MAINTENANCE IN command. However, in the case of an invalid
command format, the sense data field incorrectly indicates byte 1 of
the CDB. Fix this to indicate byte 2 of the command.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: 4ab7bb976343 ("ata: libata-scsi: Refactor ata_scsiop_maint_in()")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/libata-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index ad798e5246b4..3b65df914ebb 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3600,7 +3600,7 @@ static unsigned int ata_scsiop_maint_in(struct ata_device *dev,
 
 	if (cdb[2] != 1 && cdb[2] != 3) {
 		ata_dev_warn(dev, "invalid command format %d\n", cdb[2]);
-		ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
+		ata_scsi_set_invalid_field(dev, cmd, 2, 0xff);
 		return 0;
 	}
 
-- 
2.53.0


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

* Re: [PATCH] ata: libata-scsi: report correct sense field pointer in ata_scsiop_maint_in()
  2026-03-20  3:48 [PATCH] ata: libata-scsi: report correct sense field pointer in ata_scsiop_maint_in() Damien Le Moal
@ 2026-03-20  9:09 ` Niklas Cassel
  0 siblings, 0 replies; 2+ messages in thread
From: Niklas Cassel @ 2026-03-20  9:09 UTC (permalink / raw)
  To: linux-ide, Damien Le Moal; +Cc: Guenter Roeck

On Fri, 20 Mar 2026 12:48:01 +0900, Damien Le Moal wrote:
> Commit 4ab7bb976343 ("ata: libata-scsi: Refactor ata_scsiop_maint_in()")
> modified ata_scsiop_maint_in() to directly call
> ata_scsi_set_invalid_field() to set the field pointer of the sense data
> of a failed MAINTENANCE IN command. However, in the case of an invalid
> command format, the sense data field incorrectly indicates byte 1 of
> the CDB. Fix this to indicate byte 2 of the command.
> 
> [...]

Applied to libata/linux.git (for-7.0-fixes), thanks!

[1/1] ata: libata-scsi: report correct sense field pointer in ata_scsiop_maint_in()
      https://git.kernel.org/libata/linux/c/e6d7eba2

Kind regards,
Niklas


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

end of thread, other threads:[~2026-03-20  9:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20  3:48 [PATCH] ata: libata-scsi: report correct sense field pointer in ata_scsiop_maint_in() Damien Le Moal
2026-03-20  9:09 ` Niklas Cassel

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