Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "David Strahan" <david.strahan@microchip.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: smartpqi: add support for CCISS_BIG_PASSTHRU ioctl
Date: Wed, 22 Jul 2026 20:39:31 +0000	[thread overview]
Message-ID: <20260722203931.C31E71F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260722202327.5242-2-david.strahan@microchip.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unbounded user-controlled kmalloc and hardware transfer violation in pqi_big_passthru_ioctl
--

--- Patch [1]: [PATCH] scsi: smartpqi: add support for CCISS_BIG_PASSTHRU ioctl ---
commit 76afabc08948098cc8542c214646dcdc2c4154bf
Author: David Strahan <David.Strahan@microchip.com>

scsi: smartpqi: add support for CCISS_BIG_PASSTHRU ioctl

This commit adds pqi_big_passthru_ioctl() to handle CCISS_BIG_PASSTHRU ioctl
requests. It allows larger transfer sizes by using BIG_IOCTL_Command_struct
which stores the buffer size as a 32-bit integer.

> diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
> --- a/drivers/scsi/smartpqi/smartpqi_init.c
> +++ b/drivers/scsi/smartpqi/smartpqi_init.c
[ ... ]
> @@ -6918,6 +6918,144 @@ static int pqi_passthru_ioctl(struct pqi_ctrl_info *ctrl_info, void __user *arg)
[ ... ]
> +static int pqi_big_passthru_ioctl(struct pqi_ctrl_info *ctrl_info, void __user *arg)
> +{
[ ... ]
> +	if (iocommand.buf_size > 0) {
> +		kernel_buffer = kmalloc(iocommand.buf_size, GFP_KERNEL);

[Severity: High]
Since buf_size is a 32-bit integer controlled by userspace, can passing it
directly to kmalloc() with GFP_KERNEL cause page allocation warnings or
trigger memory pressure if the size is excessively large?

Could this allocation benefit from bounds checking or __GFP_NOWARN?

> +		if (!kernel_buffer)
> +			return -ENOMEM;
[ ... ]
> +	if (iocommand.buf_size > 0) {
> +		put_unaligned_le32(iocommand.buf_size, &request.buffer_length);
> +
> +		rc = pqi_map_single(ctrl_info->pci_dev,
> +			&request.sg_descriptors[0], kernel_buffer,
> +			iocommand.buf_size, DMA_BIDIRECTIONAL);

[Severity: High]
Does mapping the entire contiguous buffer into a single SG descriptor ignore
the hardware's max_transfer_size limits and the malloc_size chunking
mechanism?

The BIG_IOCTL_Command_struct is explicitly designed to break large transfers
into malloc_size chunks across multiple SG entries. This implementation
places everything into a single descriptor. Can sending an unchunked oversized
DMA request crash the controller firmware or cause a hardware hang?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260722202327.5242-2-david.strahan@microchip.com?part=1

  reply	other threads:[~2026-07-22 20:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22 20:23 [PATCH] scsi: smartpqi: add new pci device-ids David Strahan
2026-07-22 20:23 ` [PATCH] scsi: smartpqi: add support for CCISS_BIG_PASSTHRU ioctl David Strahan
2026-07-22 20:39   ` sashiko-bot [this message]
2026-07-22 20:23 ` [PATCH] scsi: smartpqi: Fix AIO retry marker cleared by SCSI core between dispatches David Strahan
2026-07-22 20:39   ` sashiko-bot
2026-07-22 20:23 ` [PATCH] scsi: smartpqi: update version to 2.1.42-011 David Strahan
2026-07-22 22:48 ` [PATCH] scsi: smartpqi: add new pci device-ids (please disregard, duplicate) David Strahan

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=20260722203931.C31E71F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=david.strahan@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox