From: sashiko-bot@kernel.org
To: "Rand Deeb" <rand.sec96@gmail.com>
Cc: linux-ide@vger.kernel.org, dlemoal@kernel.org, cassel@kernel.org
Subject: Re: [PATCH] ata: libata-core: Ignore forced transfer modes the host does not support
Date: Wed, 14 Oct 2026 13:12:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-171321@kernel.org> (raw)
In-Reply-To: <20261014125916.1975-1-rand.sec96@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] ata: libata-core: early return bypasses valid fallback force configs
--
commit b2b8699db9f1c2c52ee37c5d556e07a3dde1ab2e
Author: Rand Deeb <rand.sec96@gmail.com>
ata: libata-core: Ignore forced transfer modes the host does not support
This commit adds a check to ignore forced transfer modes that the host
controller does not support. This prevents out-of-bounds reads in driver
timing tables when an unsupported mode is forced.
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index 92233fb25051a..324aaa81c8a30 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -458,6 +459,17 @@ static void ata_force_xfermask(struct ata_device *dev)
>
> ata_unpack_xfermask(fe->param.xfer_mask,
> &pio_mask, &mwdma_mask, &udma_mask);
> +
> + /* Never force a transfer mode the host does not support */
> + if ((pio_mask & ~ap->pio_mask) ||
> + (mwdma_mask & ~ap->mwdma_mask) ||
> + (udma_mask & ~ap->udma_mask)) {
> + ata_dev_warn(dev,
> + "FORCE: %s not supported by the host, ignored\n",
> + fe->param.name);
> + return;
[Severity: Medium]
When a specific override is rejected by this new host capability check in
ata_force_xfermask(), does using return prematurely abort the loop?
The libata.force parameter allows stacking multiple hierarchical overrides
(e.g., libata.force=pio4,1.0:pio5), which are evaluated backwards so the
most specific match wins.
By returning instead of using continue, the code appears to silently bypass
earlier valid fallback overrides like the port-wide pio4 in the example above.
This would cause the device to fall back to its auto-negotiated mask instead
of the valid user-specified fallback, which might cause issues if the user
was relying on the fallback constraint to disable broken DMA.
> + }
> +
> if (udma_mask)
> dev->udma_mask = udma_mask;
> else if (mwdma_mask) {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014125916.1975-1-rand.sec96@gmail.com?part=1
prev parent reply other threads:[~2026-10-14 13:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 12:59 [PATCH] ata: libata-core: Ignore forced transfer modes the host does not support Rand Deeb
2026-10-14 13:12 ` sashiko-bot [this message]
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=sashiko-outbox-171321@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=rand.sec96@gmail.com \
--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