HID: amd_sfh: Fix potential NULL pointer dereference
authorEvgeny Novikov <novikov@ispras.ru>
Tue, 1 Jun 2021 16:38:01 +0000 (19:38 +0300)
committerJiri Kosina <jkosina@suse.cz>
Thu, 16 Sep 2021 07:14:33 +0000 (09:14 +0200)
commitd46ef750ed58cbeeba2d9a55c99231c30a172764
tree5b7fcf867cc478d46b47fb1726e82d637bba5dcb
parent0c8fbaa553077630e8eae45bd9676cfc01836aeb
HID: amd_sfh: Fix potential NULL pointer dereference

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>
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c