Linux ATA/IDE development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Damien Le Moal" <dlemoal@kernel.org>
Cc: dlemoal@kernel.org, cassel@kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH v4 4/5] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES
Date: Fri, 03 Jul 2026 09:05:23 +0000	[thread overview]
Message-ID: <20260703090524.77B941F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260703085152.2350034-5-dlemoal@kernel.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Reporting option 3 fails to ignore the REQUESTED SERVICE ACTION field for commands that do not have service actions.
- [Medium] Validation for reporting options 1 and 2 incorrectly handles unsupported commands by conflating 'unsupported' with 'no service action'.
--

commit f779ad68951058a9ef94049680f8a5d3f0d0be1e
Author: Damien Le Moal <dlemoal@kernel.org>

ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES

Add support for the reporting options value 2 of the in REPORT SUPPORTED
OPERATION CODES command in ata_scsi_report_supported_opcodes(). With this
reporting option, the specified opcode to check must have a service
action. Use ata_scsi_supported_cmd_has_sa() to check for this and fill the
command reply buffer using the one command format based on the command
support.

> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index dca46e7779b64..157a4b6979a89 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3774,6 +3774,13 @@ static unsigned int ata_scsi_report_supported_opcodes(struct ata_device *dev,
>  			return 0;
>  		}
>  		break;
> +	case 2:
> +		/* One command format, must have sa. */
> +		if (!ata_scsi_supported_cmd_use_sa(cdb[3])) {

[Severity: Medium]
Does ata_scsi_supported_cmd_use_sa() accurately distinguish between an
unsupported command and a command that lacks a service action?

If a host queries an unsupported command that architecturally does have
a service action (such as opcode 0x5e), it appears the helper would return
false because the command is simply not in the supported list.

For option 2, this causes the command to incorrectly fail with a check
condition (invalid field in cdb) instead of gracefully returning 'Not
supported' in the data phase.

> +			ata_scsi_set_invalid_field(dev, cmd, 3, 0xff);
> +			return 0;
> +		}
> +		fallthrough;
>  	case 3:
>  		/* One command format */
>  		sa = get_unaligned_be16(&cdb[4]);

[Severity: Medium]
Will this unconditionally read and use the service action field for
reporting option 3 even when the command doesn't have a service action?

According to the specification, the requested service action field should
be ignored for commands without service actions. If a host provides a
non-zero garbage value in this field for a command without a service action,
passing this value into ata_scsi_cmd_is_supported() might cause the lookup
to fail and incorrectly report the command as unsupported.

>  		break;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260703085152.2350034-1-dlemoal@kernel.org?part=4

  reply	other threads:[~2026-07-03  9:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03  8:51 [PATCH v4 0/5] Improve ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-03  8:51 ` [PATCH v4 1/5] ata: libata: rename ata_dev_is_zac() Damien Le Moal
2026-07-03  8:51 ` [PATCH v4 2/5] ata: libata-scsi: refactor ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-03 10:42   ` Hannes Reinecke
2026-07-03  8:51 ` [PATCH v4 3/5] ata: libata-scsi: improve service action support in ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-03  8:51 ` [PATCH v4 4/5] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES Damien Le Moal
2026-07-03  9:05   ` sashiko-bot [this message]
2026-07-03  8:51 ` [PATCH v4 5/5] ata: libata-scsi: support the all command format for reporting supported commands Damien Le Moal

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=20260703090524.77B941F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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