mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-03 08:14:12 +00:00
HID: amd_sfh: Fix potential NULL pointer dereference
[ Upstream commit d46ef750ed ]
devm_add_action_or_reset() can suddenly invoke amd_mp2_pci_remove() at
registration that will cause NULL pointer dereference since
corresponding data is not initialized yet. The patch moves
initialization of data before devm_add_action_or_reset().
Found by Linux Driver Verification project (linuxtesting.org).
[jkosina@suse.cz: rebase]
Signed-off-by: Evgeny Novikov <novikov@ispras.ru>
Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a3d0bfc22a
commit
283e4bee70
@@ -235,6 +235,10 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = amd_sfh_hid_client_init(privdata);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
privdata->cl_data = devm_kzalloc(&pdev->dev, sizeof(struct amdtp_cl_data), GFP_KERNEL);
|
||||
if (!privdata->cl_data)
|
||||
return -ENOMEM;
|
||||
@@ -245,7 +249,7 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
|
||||
|
||||
mp2_select_ops(privdata);
|
||||
|
||||
return amd_sfh_hid_client_init(privdata);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct pci_device_id amd_mp2_pci_tbl[] = {
|
||||
|
||||
Reference in New Issue
Block a user