In the Linux kernel, the following vulnerability has been resolved:
usb: cdns3 fix use-after-free at workaround 2
BUG: KFENCE: use-after-free read in _listdelentryvalid+0x10/0xac
cdns3wa2removeoldrequest() { ... kfree(privreq->request.buf); cdns3gadgetepfreerequest(&privep->endpoint, &privreq->request); listdelinit(&privreq->list); ^^^ use after free ... }
cdns3gadgetepfreerequest() free the space pointed by privreq, but privreq is used in the following listdelinit().
This patch move listdelinit() before cdns3gadgetepfreerequest().