HID: logitech: check the return value of create_singlethread_workqueue
authorKangjie Lu <kjlu@umn.edu>
Thu, 14 Mar 2019 05:24:02 +0000 (00:24 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2019 05:21:45 +0000 (07:21 +0200)
commit61effc648fe4df0d85ad255660a9bcf9d35547a0
tree1d2f1907f1d9af7e3b9e370def979b501533af91
parentdbfef4bd8836b2d8df37cd9a379302fa59e2cd1e
HID: logitech: check the return value of create_singlethread_workqueue

[ Upstream commit 6c44b15e1c9076d925d5236ddadf1318b0a25ce2 ]

create_singlethread_workqueue may fail and return NULL. The fix checks if it is
NULL to avoid NULL pointer dereference.  Also, the fix moves the call of
create_singlethread_workqueue earlier to avoid resource-release issues.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-logitech-hidpp.c