diff options
author | Jia-Ju Bai <baijiaju1990@gmail.com> | 2022-02-25 06:41:10 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2022-03-01 17:56:43 +0300 |
commit | fe23b6bbeac40de957724b90a88d46fb336e29a9 (patch) | |
tree | c587549ac8c6b1038064a014a07e2cb441b415e5 /drivers/hid/hid-nintendo.c | |
parent | cc71d37fd1f11e0495b1cf580909ebea37eaa886 (diff) | |
download | linux-fe23b6bbeac40de957724b90a88d46fb336e29a9.tar.xz |
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>
Diffstat (limited to 'drivers/hid/hid-nintendo.c')
-rw-r--r-- | drivers/hid/hid-nintendo.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c index b6a9a0f3966e..2204de889739 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -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); |