All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: cassel@kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH v1 4/6] ata: libata-scsi: improves checks for ZBC_IN and ZBC_OUT commands support
Date: Thu, 2 Jul 2026 11:19:32 +0900	[thread overview]
Message-ID: <a6cbe516-7147-48da-8cdc-b67ebfa0dcce@kernel.org> (raw)
In-Reply-To: <20260702020737.E00E61F000E9@smtp.kernel.org>

On 7/2/26 11:07, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] ZBC_IN is incorrectly evaluated as not having service actions because ZI_REPORT_ZONES equals 0, breaking all REPORT SUPPORTED OPERATION CODES (RSOC) formats.
> --
> 
> commit 6af9854276b3609a524ea350c87e6e2924aee340
> Author: Damien Le Moal <dlemoal@kernel.org>
> 
> ata: libata-scsi: improves checks for ZBC_IN and ZBC_OUT commands support
> 
> Improve ata_scsi_cmd_is_supported() to check the service action for the
> ZBC_IN and ZBC_OUT opcodes, to correctly report supported zone management
> commands for zoned disks.
> 
>> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
>> index e432e521ad318..f9e6bda6833e4 100644
>> --- a/drivers/ata/libata-scsi.c
>> +++ b/drivers/ata/libata-scsi.c
>> @@ -3708,8 +3708,17 @@ static bool ata_scsi_cmd_is_supported(struct ata_device *dev, u8 op, u16 sa,
>>  		}
>>  		return true;
>>  	case ZBC_IN:
>> +		return sa == ZI_REPORT_ZONES && ata_dev_is_zoned(dev);
> 
> [Severity: Medium]
> Does this inadvertently break REPORT SUPPORTED OPERATION CODES (RSOC) formats
> for ZBC_IN?
> 
> Because ZI_REPORT_ZONES evaluates to 0, the helper
> ata_scsi_supported_cmd_has_sa() will evaluate this as not having service
> actions:
> 
> drivers/ata/libata-scsi.c:ata_scsi_supported_cmd_has_sa() {
>     return cmd->sa != 0;
> }
> 
> This appears to cause incorrect behavior during RSOC handling for ZBC_IN:
> 
> - Format 0 (ata_scsi_report_all_supported_opcodes) fails to set the SERVACTV
>   (Service Action Valid) bit because cmd->sa evaluates to 0.
> 
> - Format 1 incorrectly accepts ZBC_IN.
> 
> - Format 2 (ata_scsi_report_supported_opcodes) incorrectly rejects valid
>   queries for ZBC_IN with CHECK CONDITION (ILLEGAL REQUEST), preventing
>   userspace from probing ZBC_IN service actions.

Yes, these observations are correct if one assumes that "0" is a valid service
action. But it is not: the SPC specifications actually define service action "0"
as "reserved". So this is a mess, but the specifications are responsible here.

With these changes, report zones is still reported as supported and everything
works.

-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-07-02  2:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02  1:56 [PATCH v1 0/6] Improve ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02  1:56 ` [PATCH v1 1/6] ata: libata: rename ata_dev_is_zac() Damien Le Moal
2026-07-02  1:56 ` [PATCH v1 2/6] ata: libata-scsi: refactor ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02  1:56 ` [PATCH v1 3/6] ata: libata-scsi: improve service action support in ata_scsi_report_supported_opcodes() Damien Le Moal
2026-07-02  2:11   ` sashiko-bot
2026-07-02  1:56 ` [PATCH v1 4/6] ata: libata-scsi: improves checks for ZBC_IN and ZBC_OUT commands support Damien Le Moal
2026-07-02  2:07   ` sashiko-bot
2026-07-02  2:19     ` Damien Le Moal [this message]
2026-07-02  1:56 ` [PATCH v1 5/6] ata: libata-scsi: support reporting options 2 in REPORT SUPPORTED OPERATION CODES Damien Le Moal
2026-07-02  2:13   ` sashiko-bot
2026-07-02  1:56 ` [PATCH v1 6/6] ata: libata-scsi: support the all command format for reporting supported commands Damien Le Moal
2026-07-02  2:11   ` sashiko-bot
2026-07-02  2:27     ` 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=a6cbe516-7147-48da-8cdc-b67ebfa0dcce@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=cassel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.