In the Linux kernel, the following vulnerability has been resolved:
ftrace: Fix null pointer dereference in ftraceaddmod()
The @ftracemod is allocated by kzalloc(), so both the members {prev,next} of @ftracemode->list are NULL, it's not a valid state to call listdel(). If kstrdup() for @ftracemod->{func|module} fails, it goes to @outfree tag and calls freeftracemod() to destroy @ftracemod, then list_del() will write prev->next and next->prev, where null pointer dereference happens.
BUG: kernel NULL pointer dereference, address: 0000000000000008 Oops: 0002 [#1] PREEMPT SMP NOPTI Call Trace: <TASK> ftracemodcallback+0x20d/0x220 ? dofilpopen+0xd9/0x140 ftraceprocessregex.isra.51+0xbf/0x130 ftraceregexwrite.isra.52.part.53+0x6e/0x90 vfswrite+0xee/0x3a0 ? _auditfilterop+0xb1/0x100 ? auditdtesttask+0x38/0x50 ksyswrite+0xa5/0xe0 dosyscall64+0x3a/0x90 entrySYSCALL64after_hwframe+0x63/0xcd Kernel panic - not syncing: Fatal exception
So call INITLISTHEAD() to initialize the list member to fix this issue.