Skip to contentSkip to conversation

net: strparser: fix a missing check for create_singlethread_workqueue

PATCH Applied Kangjie Lu 2 participants 2 messages Mar 15, 2019

Subsystems (2)
lore
Share & tools
lore

Kangjie Lu

author
#0 lore raw

PATCH 1/1 net: strparser: fix a missing check for create_singlethread_workqueue

In case create_singlethread_workqueue fails, the check returns an error to callers to avoid potential NULL pointer dereferences.

---
 net/strparser/strparser.c | 2 ++
 1 file changed, 2 insertions(+)
net/strparser/strparser.c +2 -0
index da1a676860ca..860dcfb95ee4 100644
@@ -550,6 +550,8 @@ EXPORT_SYMBOL_GPL(strp_check_rcv);
 static int __init strp_mod_init(void)
 {
 	strp_wq = create_singlethread_workqueue("kstrp");
+	if (unlikely(!strp_wq))
+		return -ENOMEM;
 
 	return 0;
 }
Signature · 1 line
2.17.1