All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hui Peng" <benquike@gmail.com>
Cc: dlemoal@kernel.org, cassel@kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH] ata: libata-scsi: reject multi-sector taskfile commands when dev->multi_count is 0
Date: Sat, 19 Sep 2026 22:46:46 +0000	[thread overview]
Message-ID: <20260919224646.E37DF1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260919222625.3797581-1-benquike@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] scsi: incorrect error field pointer for ATA_32 variable length CDBs
--

commit 19f1f1458eecf6dc97d38273c4c750d2aff47ab1
Author: Hui Peng <benquike@gmail.com>

ata: libata-scsi: reject multi-sector taskfile commands when dev->multi_count is 0

This patch rejects ATA_PROT_PIO multi-sector commands with -EINVAL when 
dev->multi_count is 0. It does this by catching the condition early and 
triggering an error path to avoid divide-by-zero or warnings in the 
taskfile path.

> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index d2160ee7ca7d4..3fc4f0377e991 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3473,6 +3473,11 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
>  	if (is_multi_taskfile(tf)) {
>  		unsigned int multi_count = 1 << (cdb[1] >> 5);
>  
> +		if (!dev->multi_count) {
> +			fp = (cdb[0] == ATA_16) ? 14 : 9;

[Severity: Low]
Does this fallback to 9 incorrectly handle ATA_32 variable length CDBs?

When an ATA_32 pass-through command specifies a multi-sector command in
ata_scsi_pass_thru() but the device does not support it, this code rejects
the command and sets the invalid field pointer (fp) to 9. For an ATA_12
command, byte 9 is the command field, but for an ATA_32 variable length CDB
(opcode 0x7F), byte 9 is the Service Action lower byte, and the command
field is at byte 25.

Could this result in the SCSI sense data incorrectly pointing to byte 9
instead of byte 25 on the error path for ATA_32 commands?

> +			goto invalid_fld;
> +		}
> +
>  		/* compare the passed through multi_count
>  		 * with the cached multi_count of libata
>  		 */

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260919222625.3797581-1-benquike@gmail.com?part=1

  reply	other threads:[~2026-09-19 22:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 22:26 [PATCH] ata: libata-scsi: reject multi-sector taskfile commands when dev->multi_count is 0 Hui Peng
2026-09-19 22:46 ` sashiko-bot [this message]
2026-09-20  4:32 ` Damien Le Moal
2026-09-21  3:25   ` [PATCH v2] ata: libata-scsi: abort multi-sector pass-through commands when multi_count " Hui Peng
2026-09-21  7:07     ` Damien Le Moal
2026-09-21  9:54     ` Niklas Cassel
2026-09-21 10:03     ` Niklas Cassel

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=20260919224646.E37DF1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=benquike@gmail.com \
    --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 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.