Patch "scsi: hpsa: Fix possible memory leak in hpsa_init_one()" has been added to the 5.10-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_init_one()

to the 5.10-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_init_one.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 998c61b0e517f4abd69621cbe4e1cf51b9daf93d
Author: Yuan Can <yuancan@xxxxxxxxxx>
Date:   Tue Nov 22 01:57:51 2022 +0000

    scsi: hpsa: Fix possible memory leak in hpsa_init_one()
    
    [ Upstream commit 9c9ff300e0de07475796495d86f449340d454a0c ]
    
    The hpda_alloc_ctlr_info() allocates h and its field reply_map. However, in
    hpsa_init_one(), if alloc_percpu() failed, the hpsa_init_one() jumps to
    clean1 directly, which frees h and leaks the h->reply_map.
    
    Fix by calling hpda_free_ctlr_info() to release h->replay_map and h instead
    free h directly.
    
    Fixes: 8b834bff1b73 ("scsi: hpsa: fix selection of reply queue")
    Signed-off-by: Yuan Can <yuancan@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221122015751.87284-1-yuancan@xxxxxxxxxx
    Reviewed-by: Ming Lei <ming.lei@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 8df70c92911d..cd78d77911cd 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -8904,7 +8904,7 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		destroy_workqueue(h->monitor_ctlr_wq);
 		h->monitor_ctlr_wq = NULL;
 	}
-	kfree(h);
+	hpda_free_ctlr_info(h);
 	return rc;
 }
 



[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