Skip to content

Commit fe23b6b

Browse files
XidianGeneralJiri Kosina
authored andcommitted
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: c4eae84 ("HID: nintendo: add rumble support") Reported-by: TOTE Robot <[email protected]> Signed-off-by: Jia-Ju Bai <[email protected]> Reviewed-by: Silvan Jegen <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent cc71d37 commit fe23b6b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/hid/hid-nintendo.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,6 +2128,10 @@ static int nintendo_hid_probe(struct hid_device *hdev,
21282128
spin_lock_init(&ctlr->lock);
21292129
ctlr->rumble_queue = alloc_workqueue("hid-nintendo-rumble_wq",
21302130
WQ_FREEZABLE | WQ_MEM_RECLAIM, 0);
2131+
if (!ctlr->rumble_queue) {
2132+
ret = -ENOMEM;
2133+
goto err;
2134+
}
21312135
INIT_WORK(&ctlr->rumble_worker, joycon_rumble_worker);
21322136

21332137
ret = hid_parse(hdev);

0 commit comments

Comments
 (0)