Re: [PATCH v5 11/27] scsi-multipath: introduce basic SCSI device support

[email protected]
Newsgroups org.kernel.vger.linux-scsi
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] scsi_mpath_unique_lun_id incorrectly accepts a 0-length LUN ID as a valid unique identifier.
--

--- Patch [11]: [PATCH v5 11/27] scsi-multipath: introduce basic SCSI device support ---
commit b27d35f732d009c9f3684249b66e5403b7b120c1
Author: John Garry <[email protected]>

scsi-multipath: introduce basic SCSI device support

This commit introduces the scsi_mpath_device structure to hold
multipath-specific details for SCSI devices. It also adds a module
parameter to control multipath modes (on, off, always).

> diff --git a/drivers/scsi/scsi_multipath.c b/drivers/scsi/scsi_multipath.c
> new file mode 100644
> index 0000000000000..947f3e2103e6b
> --- /dev/null
> +++ b/drivers/scsi/scsi_multipath.c

[ ... ]

> +static int scsi_mpath_unique_lun_id(struct scsi_device *sdev)
> +{
> +	struct scsi_mpath_device *scsi_mpath_dev = sdev->scsi_mpath_dev;
> +	int ret;
> +
> +	ret = scsi_vpd_lun_id(sdev, scsi_mpath_dev->device_id_str,
> +				SCSI_MPATH_DEVICE_ID_LEN);
> +	if (ret < 0)
> +		return ret;

[Severity: High]
If a SCSI device returns a 0-length designator in VPD page 83,
scsi_vpd_lun_id() will return 0. Does checking only for (ret < 0)
incorrectly accept a 0-length LUN ID as a valid unique identifier?

If multiple devices lack a unique ID and return 0, could they all be
assigned an empty string and incorrectly aggregated into the same
multipath group? This might risk routing I/Os intended for one device 
to a completely different device.

> +
> +	return 0;
> +}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.