mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
scsi: mpt3sas: Avoid freeing unallocated PCIe SGL buffers
_base_release_memory_pools() unconditionally frees every
ioc->pcie_sg_lookup[] entry, including ones the setup loop never
allocated after a partial failure, causing a "bad dma" warning on debug
kernels or a NULL pointer dereference otherwise.
Fixes: dbec4c9040 ("scsi: mpt3sas: lockless command submission")
Reported-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Link: https://patch.msgid.link/20260808151010.185603-1-chandrakanth.patil@broadcom.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
This commit is contained in:
parent
431e735e9b
commit
b9f679dfe6
|
|
@ -5870,6 +5870,8 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
|
|||
|
||||
if (ioc->pcie_sgl_dma_pool) {
|
||||
for (i = 0; i < ioc->scsiio_depth; i++) {
|
||||
if (!ioc->pcie_sg_lookup[i].pcie_sgl)
|
||||
continue;
|
||||
dma_pool_free(ioc->pcie_sgl_dma_pool,
|
||||
ioc->pcie_sg_lookup[i].pcie_sgl,
|
||||
ioc->pcie_sg_lookup[i].pcie_sgl_dma);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user