[PATCH openEuler-1.0-LTS] scsi: hpsa: Fix possible memory leak in hpsa_init_one()
From: Yuan Can <yuancan@huawei.com> stable inclusion from stable-v4.19.270 commit f4d1c14e8b404766ff2bb8644bb19443d73965de category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IDBMU6 CVE: CVE-2022-50646 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=... -------------------------------- [ 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@huawei.com> Link: https://lore.kernel.org/r/20221122015751.87284-1-yuancan@huawei.com Reviewed-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Conflicts: drivers/scsi/hpsa.c [ Context difference due to not merged 0119208885b3faf2459de6d3fcc6d090580b906f ] Signed-off-by: Zhang Kunbo <zhangkunbo@huawei.com> --- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index dac636880b4d..32ec27b6ab18 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -8793,7 +8793,7 @@ static int hpsa_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) destroy_workqueue(h->rescan_ctlr_wq); h->rescan_ctlr_wq = NULL; } - kfree(h); + hpda_free_ctlr_info(h); return rc; } -- 2.34.1
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/19654 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/YUB... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/19654 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/YUB...
participants (2)
-
patchwork bot -
Zhang Kunbo