Re: [PATCH] scsi: smartpqi: fix memory leak in pqi_report_phys_luns()
From: Don.Brace
Date: Tue Feb 03 2026 - 14:55:03 EST
________________________________________
From: Zilin Guan <zilin@xxxxxxxxxx>
Sent: Saturday, January 31, 2026 3:36 AM
To: Don Brace - C33706 <Don.Brace@xxxxxxxxxxxxx>
Cc: James.Bottomley@xxxxxxxxxxxxxxxxxxxxx <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>; martin.petersen@xxxxxxxxxx <martin.petersen@xxxxxxxxxx>; Scott Teel - C33730 <Scott.Teel@xxxxxxxxxxxxx>; john.p.donnelly@xxxxxxxxxx <john.p.donnelly@xxxxxxxxxx>; Scott Benesh - C33703 <Scott.Benesh@xxxxxxxxxxxxx>; Mike McGowen - C62625 <Mike.McGowen@xxxxxxxxxxxxx>; storagedev <storagedev@xxxxxxxxxxxxx>; linux-scsi@xxxxxxxxxxxxxxx <linux-scsi@xxxxxxxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx <linux-kernel@xxxxxxxxxxxxxxx>; jianhao.xu@xxxxxxxxxx <jianhao.xu@xxxxxxxxxx>; Zilin Guan <zilin@xxxxxxxxxx>
Subject: [PATCH] scsi: smartpqi: fix memory leak in pqi_report_phys_luns()
EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
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@xxxxxxxxxx>
Thanks for your patch. Like the minimal change.
Tested-by: Don Brace <don.brace@xxxxxxxxxxxxx>
Acked-by: Don Brace <don.brace@xxxxxxxxxxxxx>