]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: hpsa: Fix possible memory leak in hpsa_add_sas_device()
authorYang Yingliang <yangyingliang@huawei.com>
Fri, 11 Nov 2022 04:30:12 +0000 (12:30 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:26:20 +0000 (13:26 +0100)
commit7a5537cb464461088f16283b7521dcdf65696ce0
tree5610e5ee2270c2f03b17b9726fc1f58a5e7fe517
parent6617b4fee3d2f3088abc0ee1d4ffa41507f56bee
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@huawei.com>
Link: https://lore.kernel.org/r/20221111043012.1074466-1-yangyingliang@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/hpsa.c