]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
scsi: smartpqi: Fix memory leak in pqi_report_phys_luns()
authorZilin Guan <zilin@seu.edu.cn>
Sat, 31 Jan 2026 09:36:41 +0000 (09:36 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 4 Feb 2026 03:23:32 +0000 (22:23 -0500)
commit41b37312bd9722af77ec7817ccf22d7a4880c289
tree308e31cd78217e3f30d503bef562e813f6664f47
parent21a16f0f02263db5a1bc4739036abca698b8808f
scsi: smartpqi: Fix memory leak in pqi_report_phys_luns()

pqi_report_phys_luns() fails to release the rpl_list buffer when
encountering an unsupported data format or when the allocation for
rpl_16byte_wwid_list fails. These early returns bypass the cleanup logic,
leading to memory leaks.

Consolidate the error handling by adding an out_free_rpl_list label and use
goto statements to ensure rpl_list is consistently freed on failure.

Compile tested only. Issue found using a prototype static analysis tool and
code review.

Fixes: 28ca6d876c5a ("scsi: smartpqi: Add extended report physical LUNs")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Tested-by: Don Brace <don.brace@microchip.com>
Acked-by: Don Brace <don.brace@microchip.com>
Link: https://patch.msgid.link/20260131093641.1008117-1-zilin@seu.edu.cn
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/smartpqi/smartpqi_init.c