In the Linux kernel, the following vulnerability has been resolved: cachefiles: wait for ondemandobjectworker to finish when dropping object When queuing ondemandobjectworker() to re-open the object, cachefilesobject is not pinned. The cachefilesobject may be freed when the pending read request is completed intentionally and the related erofs is umounted. If ondemandobjectworker() runs after the object is freed, it will incur use-after-free problem as shown below. process A processs B process C process D cachefilesondemandsendreq() // send a read req X // wait for its completion // close ondemand fd cachefilesondemandfdrelease() // set object as CLOSE cachefilesondemanddaemonread() // set object as REOPENING queuework(fscachewq, &info->ondemandwork) // close /dev/cachefiles cachefilesdaemonrelease cachefilesflushreqs complete(&req->done) // read req X is completed // umount the erofs fs cachefilesputobject() // object will be freed cachefilesondemanddeinitobjinfo() kmemcachefree(object) // both info and object are freed ondemandobjectworker() When dropping an object, it is no longer necessary to reopen the object, so use cancelworksync() to cancel or wait for ondemandobjectworker() to finish.