Re: [PATCH] scsi: megaraid_sas: fix PRP list out-of-bounds write
"Martin K. Petersen" <[email protected]> Sun, 12 Jul 2026 22:16:39 -0400
| Newsgroups | dev.linux.lists.regressions,org.kernel.vger.linux-scsi |
|---|---|
| Message-ID | <[email protected]> |
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; }