In the Linux kernel, the following vulnerability has been resolved:
usb: cdns3: fixed memory use after free at cdns3gadgetep_disable()
... cdns3gadgetepfreerequest(&privep->endpoint, &privreq->request); listdelinit(&priv_req->list); ...
'privreq' actually free at cdns3gadgetepfreerequest(). But listdelinit() use privreq->list after it.
[ 1542.642868][ T534] BUG: KFENCE: use-after-free read in _listdelentryvalid+0x10/0xd4 [ 1542.642868][ T534] [ 1542.653162][ T534] Use-after-free read at 0x000000009ed0ba99 (in kfence-#3): [ 1542.660311][ T534] _listdelentryvalid+0x10/0xd4 [ 1542.665375][ T534] cdns3gadgetepdisable+0x1f8/0x388 [cdns3] [ 1542.671571][ T534] usbepdisable+0x44/0xe4 [ 1542.675948][ T534] ffsfuncepsdisable+0x64/0xc8 [ 1542.680839][ T534] ffsfuncsetalt+0x74/0x368 [ 1542.685478][ T534] ffsfunc_disable+0x18/0x28
Move listdelinit() before cdns3gadgetepfreerequest() to resolve this problem.