From: sashiko-bot@kernel.org
To: "Phil Pemberton" <philpem@philpem.me.uk>
Cc: linux-scsi@vger.kernel.org, cassel@kernel.org,
dlemoal@kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH v10 14/15] ata: libata-scsi: probe additional LUNs for multi-LUN ATAPI devices
Date: Fri, 09 Oct 2026 16:44:03 +0000 [thread overview]
Message-ID: <sashiko-outbox-165843@kernel.org> (raw)
In-Reply-To: <20261009155522.593045-15-philpem@philpem.me.uk>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ata: libata-scsi: manual scan of ATAPI targets bypasses OF node assignment
--
commit 8bad316476ffbbf5d3a2fdb9796c051181202764
Author: Phil Pemberton <philpem@philpem.me.uk>
ata: libata-scsi: probe additional LUNs for multi-LUN ATAPI devices
After adding LUN 0 of an ATAPI device marked BLIST_FORCELUN, scan the
target's remaining LUNs using scsi_scan_target(). The scan is bounded by
shost->max_lun, set through atapi_max_lun.
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index faf408acf65ec..bba2db2f84284 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
[ ... ]
> @@ -5647,6 +5662,37 @@ int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
> } else
> spin_unlock_irqrestore(ap->lock, flags);
>
> + if (!rc) {
> + struct ata_link *link;
> + struct ata_device *dev;
> +
> + /* EH does not scan missing LUNs on an already attached target. */
> + mutex_lock(&ap->scsi_scan_mutex);
> + ata_for_each_link(link, ap, EDGE) {
> + ata_for_each_dev(dev, link, ENABLED) {
[ ... ]
> + scsi_scan_target(&shost->shost_gendev,
> + scan_channel, scan_id, lun,
> + SCSI_SCAN_MANUAL);
> + ata_scsi_publish_sdevs(dev);
^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Severity: High]
Does this manual scan bypass OF node assignment and multi-LUN scanning for
newly attached ATAPI targets?
If a user initiates a manual scan via sysfs (for example, using
echo "- - -" > /sys/class/scsi_host/hostX/scan), ata_scsi_user_scan()
schedules and waits for EH. EH configures the device and queues
hotplug_task (a delayed work).
Because ata_scsi_user_scan() continues immediately, it usually beats the
deferred hotplug_task and populates dev->sdev[0] here via
ata_scsi_publish_sdevs().
When hotplug_task subsequently runs ata_scsi_scan_host(), it skips the
remaining initialization due to the guard check in ata_scsi_scan_host():
drivers/ata/libata-scsi.c:ata_scsi_scan_host() {
...
if (dev->sdev[0])
continue;
...
}
Will this entirely bypass ata_scsi_assign_ofnode() and the new BLIST_FORCELUN
multi-LUN scan logic for the target, potentially affecting device tree
bindings and leaving secondary LUNs inaccessible?
> + }
> + }
> + mutex_unlock(&ap->scsi_scan_mutex);
> + }
> +
> return rc;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009155522.593045-1-philpem@philpem.me.uk?part=14
next prev parent reply other threads:[~2026-10-09 16:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 15:55 [PATCH v10 00/15] ata: add multi-LUN support for ATAPI devices Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 01/15] ata: libata-acpi: pin the SCSI device while emitting a bay event Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 02/15] scsi: core: release the device tree node at final device release Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 03/15] ata: libata-zpodd: reference SCSI devices in PM callbacks Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 04/15] ata: libata-zpodd: publish initialized state before registering notifications Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 05/15] ata: libata-zpodd: serialize wake attribution with physical power-on Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 06/15] ata: libata-core: pin SCSI devices during port detach Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 07/15] scsi: scsi_devinfo: preserve full-width quirk identifiers Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 08/15] scsi: sr: keep queue block sizes in sync with the medium Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 09/15] scsi: sr: retry unfinished media revalidation on the next open Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 10/15] ata: libata-scsi: add atapi_max_lun module parameter Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 11/15] ata: libata-scsi: convert dev->sdev to per-LUN array Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 12/15] ata: libata-scsi: route non-zero LUN commands for multi-LUN ATAPI Phil Pemberton
2026-10-09 15:55 ` [PATCH v10 13/15] scsi: add BLIST_NO_LUN_1F blacklist flag Phil Pemberton
2026-10-09 16:38 ` sashiko-bot
2026-10-09 15:55 ` [PATCH v10 14/15] ata: libata-scsi: probe additional LUNs for multi-LUN ATAPI devices Phil Pemberton
2026-10-09 16:44 ` sashiko-bot [this message]
2026-10-09 15:55 ` [PATCH v10 15/15] scsi: scsi_devinfo: add COMPAQ PD-1 multi-LUN ATAPI device quirk Phil Pemberton
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-165843@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=philpem@philpem.me.uk \
--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.