All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hid: logitech: check the return value of create_singlethread_workqueue
@ 2019-03-09  4:43 Kangjie Lu
  2019-03-11 15:08 ` Benjamin Tissoires
  0 siblings, 1 reply; 6+ messages in thread
From: Kangjie Lu @ 2019-03-09  4:43 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel

create_singlethread_workqueue may fail and return NULL. The fix
checks if it is NULL to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/hid/hid-logitech-hidpp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 15ed6177a7a3..efbc39b92aa2 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -2156,6 +2156,9 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, u8 feature_index)
 
 	/* init the hardware command queue */
 	data->wq = create_singlethread_workqueue("hidpp-ff-sendqueue");
+	if (!data->wq)
+		return -ENOMEM;
+
 	atomic_set(&data->workqueue_size, 0);
 
 	/* initialize with zero autocenter to get wheel in usable state */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-03-19 10:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09  4:43 [PATCH] hid: logitech: check the return value of create_singlethread_workqueue Kangjie Lu
2019-03-11 15:08 ` Benjamin Tissoires
2019-03-12  6:16   ` [PATCH v2] " Kangjie Lu
2019-03-12 16:02     ` Jonathan Corbet
2019-03-14  5:24       ` [PATCH v3] " Kangjie Lu
2019-03-19 10:48         ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.