net: strparser: fix a missing check for create_singlethread_workqueue
authorKangjie Lu <kjlu@umn.edu>
Fri, 15 Mar 2019 04:12:06 +0000 (23:12 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Mar 2019 19:51:56 +0000 (12:51 -0700)
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@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/strparser/strparser.c

index da1a676860cad3c8a2a95acf11f0e908fe2bc255..860dcfb95ee472fed5d74e6015af2acce178c0a7 100644 (file)
@@ -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;
 }