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 v2 4/5] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES
Date: Thu, 02 Jul 2026 06:52:27 +0000 [thread overview]
Message-ID: <20260702065227.EA8671F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260702063412.1892584-5-dlemoal@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Reporting options 1 and 2 incorrectly terminate with CHECK CONDITION (INVALID FIELD IN CDB) for valid queries, violating SCSI protocol.
- [Medium] Reporting option 3 incorrectly evaluates the REQUESTED SERVICE ACTION field for commands that do not use service actions.
--
commit 8b0fcbdec2fbb5690930a99f6f8a7faf9e8bd511
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 86ac41a7d81ab..e75ed573e234b 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3737,6 +3737,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])) {
> + ata_scsi_set_invalid_field(dev, cmd, 3, 0xff);
> + return 0;
> + }
[Severity: Medium]
Does this validation check incorrectly abort execution with a SCSI error for
option 2 commands that are unknown?
According to SPC-5, option 2 queries for unsupported commands (and similarly,
option 1 queries for commands with service actions) must return SUPPORT=001b.
Instead, this implementation erroneously aborts the command by calling
ata_scsi_set_invalid_field(), preventing the code from falling through and
correctly populating the response buffer.
> + fallthrough;
> case 3:
> /* One command format */
> sa = get_unaligned_be16(&cdb[4]);
[Severity: Medium]
If an initiator issues REPORT SUPPORTED OPERATION CODES with option 3 for a
standard command that lacks service actions, while providing non-zero data in
the requested service action field, wouldn't this unconditional extraction of
sa cause a regression?
SPC-5 dictates that if the requested opcode does not have service actions, the
requested service action field must be ignored. By unconditionally extracting
sa here, it will fail to match in ata_scsi_get_supported_cmd() since
non-service-action commands expect sa == 0, improperly yielding SUPPORT=001b
for a valid, supported command.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260702063412.1892584-1-dlemoal@kernel.org?part=4
next prev parent reply other threads:[~2026-07-02 6:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 6:34 [PATCH v2 0/5] Improve ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02 6:34 ` [PATCH v2 1/5] ata: libata: rename ata_dev_is_zac() Damien Le Moal
2026-07-02 6:38 ` Hannes Reinecke
2026-07-02 7:16 ` sashiko-bot
2026-07-02 6:34 ` [PATCH v2 2/5] ata: libata-scsi: refactor ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02 6:44 ` Hannes Reinecke
2026-07-02 7:01 ` Damien Le Moal
2026-07-02 6:53 ` sashiko-bot
2026-07-02 13:25 ` Niklas Cassel
2026-07-02 14:36 ` Niklas Cassel
2026-07-02 14:48 ` Christoph Hellwig
2026-07-02 14:53 ` Niklas Cassel
2026-07-02 6:34 ` [PATCH v2 3/5] ata: libata-scsi: improve service action support in ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02 6:45 ` Hannes Reinecke
2026-07-02 6:47 ` sashiko-bot
2026-07-02 6:34 ` [PATCH v2 4/5] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES Damien Le Moal
2026-07-02 6:46 ` Hannes Reinecke
2026-07-02 6:52 ` sashiko-bot [this message]
2026-07-02 7:00 ` Damien Le Moal
2026-07-02 11:41 ` Niklas Cassel
2026-07-02 6:53 ` Hannes Reinecke
2026-07-02 6:34 ` [PATCH v2 5/5] ata: libata-scsi: support the all command format for reporting supported commands Damien Le Moal
2026-07-02 6:54 ` Hannes Reinecke
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=20260702065227.EA8671F000E9@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