nicman23 / dkms-hid-nintendo

dkms-hid-nintendo
GNU General Public License v2.0
235 stars 42 forks source link

HID: nintendo: check the return value of alloc_workqueue() #59

Closed SuperSamus closed 2 years ago

SuperSamus commented 2 years ago

Ported from upstream.

nfp0 commented 2 years ago

What is this for?

SuperSamus commented 2 years ago

From the commit description:

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: https://github.com/torvalds/linux/commit/c4eae84feff3e68c2f385aa10faea4a96791e7ad ("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>
nfp0 commented 2 years ago

@SuperSamus Thank you, I could not find the original commit.

nfp0 commented 2 years ago

This is in no way related to the current random disconnection issues, or is it?

v1993 commented 2 years ago

Yes, it is unrelated. This is just an extra safety check to prevent invalid memory access in case of allocation failure.

Disconnects are an issue with bluetooth stack rather than this module itself from what I know.