[PATCH] net: strparser: fix a missing check for create_singlethread_workqueue

From: Kangjie Lu
Date: Fri Mar 15 2019 - 00:12:28 EST


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

Signed-off-by: Kangjie Lu <kjlu@xxxxxxx>
---
net/strparser/strparser.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c
index da1a676860ca..860dcfb95ee4 100644
--- a/net/strparser/strparser.c
+++ b/net/strparser/strparser.c
@@ -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;
}
--
2.17.1