In the Linux kernel, the following vulnerability has been resolved:
misc: fastrpc: Fix use-after-free race condition for maps
It is possible that in between calling fastrpcmapget() until map->fl->lock is taken in fastrpcfreemap(), another thread can call fastrpcmaplookup() and get a reference to a map that is about to be deleted.
Rewrite fastrpcmapget() to only increase the reference count of a map if it's non-zero. Propagate this to callers so they can know if a map is about to be deleted.
Fixes this warning: refcountt: addition on 0; use-after-free. WARNING: CPU: 5 PID: 10100 at lib/refcount.c:25 refcountwarnsaturate ... Call trace: refcountwarnsaturate [fastrpcmapget inlined] [fastrpcmaplookup inlined] fastrpcmapcreate fastrpcinternalinvoke fastrpcdeviceioctl _arm64sysioctl invoke_syscall
[
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"26631712104425587117936640061801269608",
"255261818338216448767479529387041697636",
"330262804528915546271275589238222307223",
"182201231387761933748816421967270044811",
"179722066082401702573768705707600519514",
"30111731605652313993943748736012539615",
"120576493713803407098717095542368805152"
]
},
"signature_type": "Line",
"target": {
"file": "drivers/misc/fastrpc.c"
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@079c78c68714f7d8d58e66c477b0243b31806907",
"signature_version": "v1",
"id": "CVE-2022-48872-8f6d4f81"
},
{
"digest": {
"length": 91.0,
"function_hash": "245421493454284050264583754092885606831"
},
"signature_type": "Function",
"target": {
"function": "fastrpc_map_get",
"file": "drivers/misc/fastrpc.c"
},
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@079c78c68714f7d8d58e66c477b0243b31806907",
"signature_version": "v1",
"id": "CVE-2022-48872-9a507289"
}
]