In the Linux kernel, the following vulnerability has been resolved:
nbd: call genlunregisterfamily() first in nbd_cleanup()
Otherwise there may be race between module removal and the handling of netlink command, which can lead to the oops as shown below:
BUG: kernel NULL pointer dereference, address: 0000000000000098 Oops: 0002 [#1] SMP PTI CPU: 1 PID: 31299 Comm: nbd-client Tainted: G E 5.14.0-rc4 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) RIP: 0010:downwrite+0x1a/0x50 Call Trace: startcreating+0x89/0x130 debugfscreatedir+0x1b/0x130 nbdstartdevice+0x13d/0x390 [nbd] nbdgenlconnect+0x42f/0x748 [nbd] genlfamilyrcvmsgdoit.isra.0+0xec/0x150 genlrcvmsg+0xe5/0x1e0 netlinkrcvskb+0x55/0x100 genlrcv+0x29/0x40 netlinkunicast+0x1a8/0x250 netlinksendmsg+0x21b/0x430 syssendmsg+0x2a4/0x2d0 syssendmsg+0x81/0xc0 _syssendmsg+0x62/0xb0 _x64syssendmsg+0x1f/0x30 dosyscall64+0x3b/0xc0 entrySYSCALL64after_hwframe+0x44/0xae Modules linked in: nbd(E-)