Commit 2588783
committed
Add error handling for workqueue allocation
Previously, sched_init() did not check whether alloc_workqueue() succeeded.
This could lead to a NULL pointer dereference and kernel crash if memory
allocation failed. This commit adds a check for a NULL return and logs an
error message if allocation fails.
By returning -ENOMEM early, we ensure the module will not be loaded in an
invalid state and avoid undefined behavior or system instability.1 parent f105003 commit 2588783
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
0 commit comments