All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Thorsten Leemhuis <regressions@leemhuis.info>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	me@magik.net,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sumit Saxena <sumit.saxena@broadcom.com>,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>,
	Chandrakanth patil <chandrakanth.patil@broadcom.com>,
	"megaraidlinux.pdl@broadcom.com" <megaraidlinux.pdl@broadcom.com>,
	"regressions@lists.linux.dev" <regressions@lists.linux.dev>,
	Mats Topstad / Intility AS <Mats.topstad@intility.no>,
	Daniel Fernau <mail@danielfernau.com>
Subject: Re: [PATCH] scsi: megaraid_sas: fix PRP list out-of-bounds write
Date: Sun, 12 Jul 2026 22:16:39 -0400	[thread overview]
Message-ID: <yq17bmzd5jr.fsf@ca-mkp.ca.oracle.com> (raw)
In-Reply-To: <b8fcdb5e-f2be-4bd0-914d-d03e87af9630@leemhuis.info> (Thorsten Leemhuis's message of "Tue, 30 Jun 2026 12:26:36 +0200")


Thorsten,

> Martin, do you know if someone there ever looked into this regression
> and the proposed fix? I'm wondering because Daniel and Mats reported
> problems under the same subject line (in new threads), but also didn't
> get a reply.

I think this problem is just an unfortunate side effect of the kernel
being able to build bigger I/Os by default.

Typically NVMe SSDs report fairly modest maximum I/O sizes compared to
SCSI devices. I suspect this is why we only see this issue with a few
select models. My hunch is that these drives advertise a fairly large
MDTS.

Since there appears to be no traction wrt. fixing the MR PRP vs. SGL
chaining logic, I wonder if the patch below is sufficient?

-- 
Martin K. Petersen

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index ecd365d78ae3..b93a6d1180ff 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1978,7 +1978,8 @@ megasas_set_nvme_device_properties(struct scsi_device *sdev,
 	mr_nvme_pg_size = max_t(u32, instance->nvme_page_size,
 				MR_DEFAULT_NVME_PAGE_SIZE);
 
-	lim->max_hw_sectors = max_io_size / 512;
+	lim->max_hw_sectors =
+		min(SZ_2M >> SECTOR_SHIFT, max_io_size >> SECTOR_SHIFT);
 	lim->virt_boundary_mask = mr_nvme_pg_size - 1;
 }
 

  parent reply	other threads:[~2026-07-13  2:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27  3:20 [PATCH] scsi: megaraid_sas: fix PRP list out-of-bounds write me
2026-04-01  7:02 ` Thorsten Leemhuis
2026-04-21  2:47 ` Martin K. Petersen
2026-06-30 10:26   ` Thorsten Leemhuis
2026-07-01 11:09     ` Mira Limbeck
2026-07-01 12:24       ` Thorsten Leemhuis
2026-07-01 12:48         ` Mira Limbeck
2026-07-13  2:16     ` Martin K. Petersen [this message]
2026-07-13 21:07       ` Daniel Fernau
2026-07-28 13:43         ` Mats Topstad / Intility AS
2026-07-29  2:34           ` Damien Le Moal
  -- strict thread matches above, loose matches on Subject: below --
2026-04-02 13:25 Daniel Fernau
2026-06-24  7:17 Mats Topstad / Intility AS

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=yq17bmzd5jr.fsf@ca-mkp.ca.oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=Mats.topstad@intility.no \
    --cc=chandrakanth.patil@broadcom.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mail@danielfernau.com \
    --cc=me@magik.net \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=regressions@leemhuis.info \
    --cc=regressions@lists.linux.dev \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=sumit.saxena@broadcom.com \
    /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.