diff options
| author | Ranjan Kumar <ranjan.kumar@broadcom.com> | 2026-09-16 13:57:04 +0530 |
|---|---|---|
| committer | Martin K. Petersen (Oracle) <mkp@kernel.org> | 2026-09-16 22:14:23 -0400 |
| commit | c90693e02d10e9318f2f7cc480e9b05430628738 (patch) | |
| tree | c7088d5f371e6cb2852b608f8e020b94e701a771 /tools/perf/scripts/python/bin/stackcollapse-record | |
| parent | 29e3f0856e8544ca185be3403518a102e0ca29fc (diff) | |
| download | linux-next-c90693e02d10e9318f2f7cc480e9b05430628738.tar.gz linux-next-c90693e02d10e9318f2f7cc480e9b05430628738.zip | |
scsi: mpi3mr: Fix SAS PHY cleanup in host addition error paths
When adding a SAS host, the driver allocates a PHY array and subsequently
creates individual SAS PHYs. If a later step fails, the error path exits
without cleaning up previously allocated resources, resulting in leaks of
both the PHY array and any registered SAS PHYs.
Additionally, the return value of mpi3mr_add_host_phy() was being ignored.
If it failed, mr_sas_phy->phy would be left as NULL, which could later lead
to a NULL pointer dereference in mpi3mr_sas_port_add() when the attached
device triggers a device addition event.
Add a dedicated cleanup path that deletes any successfully created SAS PHYs
and frees the PHY array before returning from initialization failure
paths. Also, check the return value of mpi3mr_add_host_phy() and jump to
the cleanup path on failure.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260626114109.43685-1-ranjan.kumar@broadcom.com?part=9
Co-developed-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: Ranjan Kumar <ranjan.kumar@broadcom.com>
Link: https://patch.msgid.link/20260916082705.44712-10-ranjan.kumar@broadcom.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-record')
0 files changed, 0 insertions, 0 deletions
