From: sashiko-bot@kernel.org
To: "John Garry" <john.g.garry@oracle.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3 12/13] libmultipath: Add mpath_bdev_getgeo()
Date: Fri, 03 Jul 2026 10:54:49 +0000 [thread overview]
Message-ID: <20260703105450.57EE61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260703102918.3723667-13-john.g.garry@oracle.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing NULL check for the optional fops->ioctl callback in mpath_bdev_ioctl
--
commit 5104b9e862d1fb81d42be96c9762fa0a9897083a
Author: John Garry <john.g.garry@oracle.com>
libmultipath: Add mpath_bdev_getgeo()
This patch adds mpath_bdev_getgeo() as a multipath block device .getgeo
handler. It redirects the call into the selected mpath_device disk's
fops->getgeo handler.
> diff --git a/lib/multipath.c b/lib/multipath.c
> index 4e4b347875500..26d9b17998d66 100644
> --- a/lib/multipath.c
> +++ b/lib/multipath.c
> @@ -547,6 +547,26 @@ static int mpath_bdev_ioctl(struct block_device *bdev, blk_mode_t mode,
> return err;
> }
>
> +static int mpath_bdev_getgeo(struct gendisk *disk, struct hd_geometry *geo)
> +{
> + struct mpath_head *mpath_head = mpath_gendisk_to_head(disk);
> + int srcu_idx, ret = -EWOULDBLOCK;
> + struct mpath_device *mpath_device;
> +
> + srcu_idx = srcu_read_lock(&mpath_head->srcu);
> + mpath_device = mpath_find_path(mpath_head);
> + if (mpath_device) {
> + if (mpath_device->disk->fops->getgeo)
[Severity: High]
This is a pre-existing issue, but while reviewing this patch I noticed that
the new mpath_bdev_getgeo() correctly checks if the callback is present
before executing it.
However, the pre-existing mpath_bdev_ioctl() function located just above
this code does an unconditional dereference of the ioctl callback:
lib/multipath.c:mpath_bdev_ioctl() {
...
err = mpath_device->disk->fops->ioctl(
mpath_device->disk->part0, mode, cmd, arg);
...
}
If a user-space program issues an ioctl to the multipath block device and
the underlying device driver does not implement the optional ioctl callback,
could this result in a NULL pointer dereference and system panic?
> + ret = mpath_device->disk->fops->getgeo(
> + mpath_device->disk, geo);
> + else
> + ret = -ENOTTY; /* See blkdev_getgeo */
> + }
> + srcu_read_unlock(&mpath_head->srcu, srcu_idx);
> +
> + return ret;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260703102918.3723667-1-john.g.garry@oracle.com?part=12
next prev parent reply other threads:[~2026-07-03 10:54 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 10:29 [PATCH v3 00/13] libmultipath: a generic multipath lib for block drivers John Garry
2026-07-03 10:29 ` [PATCH v3 01/13] libmultipath: Add initial framework John Garry
2026-07-03 10:43 ` sashiko-bot
2026-07-03 14:06 ` John Garry
2026-07-03 10:29 ` [PATCH v3 02/13] libmultipath: Add basic gendisk support John Garry
2026-07-03 10:51 ` sashiko-bot
2026-07-03 14:19 ` John Garry
2026-07-03 10:29 ` [PATCH v3 03/13] libmultipath: Add path selection support John Garry
2026-07-03 10:45 ` sashiko-bot
2026-07-03 14:37 ` John Garry
2026-07-03 10:29 ` [PATCH v3 04/13] libmultipath: Add bio handling John Garry
2026-07-03 10:49 ` sashiko-bot
2026-07-03 14:48 ` John Garry
2026-07-03 10:29 ` [PATCH v3 05/13] libmultipath: Add support for mpath_device management John Garry
2026-07-03 10:29 ` [PATCH v3 06/13] libmultipath: Add delayed removal support John Garry
2026-07-03 10:45 ` sashiko-bot
2026-07-03 15:18 ` John Garry
2026-07-03 10:29 ` [PATCH v3 07/13] libmultipath: Add cdev support John Garry
2026-07-03 10:48 ` sashiko-bot
2026-07-06 10:26 ` John Garry
2026-07-03 10:29 ` [PATCH v3 08/13] libmultipath: Add sysfs helpers John Garry
2026-07-03 10:44 ` sashiko-bot
2026-07-06 13:57 ` John Garry
2026-07-03 10:29 ` [PATCH v3 09/13] libmultipath: Add PR support John Garry
2026-07-03 10:48 ` sashiko-bot
2026-07-06 14:12 ` John Garry
2026-07-03 10:29 ` [PATCH v3 10/13] libmultipath: Add mpath_bdev_report_zones() John Garry
2026-07-03 10:29 ` [PATCH v3 11/13] libmultipath: Add support for block device IOCTL John Garry
2026-07-03 10:56 ` sashiko-bot
2026-07-06 14:16 ` John Garry
2026-07-03 10:29 ` [PATCH v3 12/13] libmultipath: Add mpath_bdev_getgeo() John Garry
2026-07-03 10:54 ` sashiko-bot [this message]
2026-07-03 10:29 ` [PATCH v3 13/13] libmultipath: Add mpath_bdev_get_unique_id() John Garry
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=20260703105450.57EE61F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=john.g.garry@oracle.com \
--cc=linux-scsi@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.