* [PATCH] scsi: hpsa: fix possible memory leak in hpsa_add_sas_device()
@ 2022-11-11 4:30 Yang Yingliang
2022-11-26 0:18 ` Martin K. Petersen
2022-12-01 3:45 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2022-11-11 4:30 UTC (permalink / raw)
To: linux-scsi, storagedev; +Cc: don.brace, jejb, martin.petersen, yangyingliang
If hpsa_sas_port_add_rphy() returns error, the 'rphy' allocated
in sas_end_device_alloc() need be free, fix this by calling
sas_rphy_free() in the error path.
Fixes: d04e62b9d63a ("hpsa: add in sas transport class")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/scsi/hpsa.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index b3f195467e97..1d2cad257dab 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -9823,10 +9823,12 @@ static int hpsa_add_sas_device(struct hpsa_sas_node *hpsa_sas_node,
rc = hpsa_sas_port_add_rphy(hpsa_sas_port, rphy);
if (rc)
- goto free_sas_port;
+ goto free_sas_rphy;
return 0;
+free_sas_rphy:
+ sas_rphy_free(rphy);
free_sas_port:
hpsa_free_sas_port(hpsa_sas_port);
device->sas_port = NULL;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: hpsa: fix possible memory leak in hpsa_add_sas_device()
2022-11-11 4:30 [PATCH] scsi: hpsa: fix possible memory leak in hpsa_add_sas_device() Yang Yingliang
@ 2022-11-26 0:18 ` Martin K. Petersen
2022-12-01 3:45 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-11-26 0:18 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-scsi, storagedev, don.brace, jejb, martin.petersen
Yang,
> If hpsa_sas_port_add_rphy() returns error, the 'rphy' allocated
> in sas_end_device_alloc() need be free, fix this by calling
> sas_rphy_free() in the error path.
Applied to 6.2/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi: hpsa: fix possible memory leak in hpsa_add_sas_device()
2022-11-11 4:30 [PATCH] scsi: hpsa: fix possible memory leak in hpsa_add_sas_device() Yang Yingliang
2022-11-26 0:18 ` Martin K. Petersen
@ 2022-12-01 3:45 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-12-01 3:45 UTC (permalink / raw)
To: storagedev, linux-scsi, Yang Yingliang
Cc: Martin K . Petersen, jejb, don.brace
On Fri, 11 Nov 2022 12:30:12 +0800, Yang Yingliang wrote:
> If hpsa_sas_port_add_rphy() returns error, the 'rphy' allocated
> in sas_end_device_alloc() need be free, fix this by calling
> sas_rphy_free() in the error path.
>
>
Applied to 6.2/scsi-queue, thanks!
[1/1] scsi: hpsa: fix possible memory leak in hpsa_add_sas_device()
https://git.kernel.org/mkp/scsi/c/fda34a5d304d
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-01 3:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11 4:30 [PATCH] scsi: hpsa: fix possible memory leak in hpsa_add_sas_device() Yang Yingliang
2022-11-26 0:18 ` Martin K. Petersen
2022-12-01 3:45 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.