Re: [PATCH 2/3] ata: libata-scsi: reject unsupported ATA-32 service actions

From: Damien Le Moal

Date: Wed Nov 04 2026 - 22:18:21 EST


On 11/4/26 23:11, shao.mingyin@xxxxxxxxxx wrote:
> From: Shao Mingyin <shao.mingyin@xxxxxxxxxx>
>
> ata_scsi_var_len_cdb_xlat() handles a variable length CDB only when its
> service action is ATA_32 (ATA PASS-THROUGH (32)). For any other service
> action it returns 1, which tells ata_scsi_translate() that the command
> has been handled and that scmd->result and the sense buffer were set by
> the translation function.
>
> No sense data is set in that path, so ata_scsi_translate() frees the qc
> and calls scsi_done() with scmd->result still zero. The command thus
> completes with SAM_STAT_GOOD even though no ATA command was issued and
> no data was transferred. Before ATA PASS-THROUGH (32) support was added,
> such CDBs were not claimed by ata_get_xlat_func() and were rejected by
> ata_scsi_simulate() with ILLEGAL REQUEST/INVALID COMMAND OPERATION CODE.
>
> Fail unsupported service actions with ILLEGAL REQUEST/INVALID FIELD IN
> CDB and point the field pointer at the SERVICE ACTION field.
>
> Fixes: b1ffbf854e08 ("libata: Support for an ATA PASS-THROUGH(32) command.")
> Signed-off-by: Shao Mingyin <shao.mingyin@xxxxxxxxxx>

Looks OK.

Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>


--
Damien Le Moal
Western Digital Research