Patch "scsi: hpsa: Fix possible memory leak in hpsa_add_sas_device()" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: hpsa: Fix possible memory leak in hpsa_add_sas_device()

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-hpsa-fix-possible-memory-leak-in-hpsa_add_sas_d.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 43055ecc1b1de3c47cb21d2e81499a98ff0b05cf
Author: Yang Yingliang <yangyingliang@xxxxxxxxxx>
Date:   Fri Nov 11 12:30:12 2022 +0800

    scsi: hpsa: Fix possible memory leak in hpsa_add_sas_device()
    
    [ Upstream commit fda34a5d304d0b98cc967e8763b52221b66dc202 ]
    
    If hpsa_sas_port_add_rphy() returns an error, the 'rphy' allocated in
    sas_end_device_alloc() needs to be freed. Address this by calling
    sas_rphy_free() in the error path.
    
    Fixes: d04e62b9d63a ("hpsa: add in sas transport class")
    Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221111043012.1074466-1-yangyingliang@xxxxxxxxxx
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 9d5d0c911130..ba125ed7e06a 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -9800,10 +9800,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;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux