mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
HID: nintendo: check the return value of alloc_workqueue()
The function alloc_workqueue() in nintendo_hid_probe() can fail, but there is no check of its return value. To fix this bug, its return value should be checked with new error handling code. Fixes: c4eae84feff3e ("HID: nintendo: add rumble support") Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Reviewed-by: Silvan Jegen <s.jegen@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
cc71d37fd1
commit
fe23b6bbea
@ -2128,6 +2128,10 @@ static int nintendo_hid_probe(struct hid_device *hdev,
|
||||
spin_lock_init(&ctlr->lock);
|
||||
ctlr->rumble_queue = alloc_workqueue("hid-nintendo-rumble_wq",
|
||||
WQ_FREEZABLE | WQ_MEM_RECLAIM, 0);
|
||||
if (!ctlr->rumble_queue) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
INIT_WORK(&ctlr->rumble_worker, joycon_rumble_worker);
|
||||
|
||||
ret = hid_parse(hdev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user