]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ata: libata-scsi: report correct sense field pointer in ata_scsiop_maint_in()
authorDamien Le Moal <dlemoal@kernel.org>
Fri, 20 Mar 2026 21:54:45 +0000 (17:54 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:50 +0000 (11:08 +0100)
[ Upstream commit e6d7eba23b666d85cacee0643be280d6ce1ebffc ]

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>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ata/libata-scsi.c

index bfabf27adfce5a8bd10f7e2ff18c50d19374de96..b55443e31f40337e4b5227608574ad1779caee72 100644 (file)
@@ -3611,7 +3611,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;
        }