{"id":"CVE-2024-41058","aliases":["CVE-2024-41058"],"related":[],"kind":"vulnerability","state":"published","title":"cachefiles: fix slab-use-after-free in fscache_withdraw_volume()","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\ncachefiles: fix slab-use-after-free in fscache_withdraw_volume()\n\nWe got the following issue in our fault injection stress test:\n\n==================================================================\nBUG: KASAN: slab-use-after-free in fscache_withdraw_volume+0x2e1/0x370\nRead of size 4 at addr ffff88810680be08 by task ondemand-04-dae/5798\n\nCPU: 0 PID: 5798 Comm: ondemand-04-dae Not tainted 6.8.0-dirty #565\nCall Trace:\n kasan_check_range+0xf6/0x1b0\n fscache_withdraw_volume+0x2e1/0x370\n cachefiles_withdraw_volume+0x31/0x50\n cachefiles_withdraw_cache+0x3ad/0x900\n cachefiles_put_unbind_pincount+0x1f6/0x250\n cachefiles_daemon_release+0x13b/0x290\n __fput+0x204/0xa00\n task_work_run+0x139/0x230\n\nAllocated by task 5820:\n __kmalloc+0x1df/0x4b0\n fscache_alloc_volume+0x70/0x600\n __fscache_acquire_volume+0x1c/0x610\n erofs_fscache_register_volume+0x96/0x1a0\n erofs_fscache_register_fs+0x49a/0x690\n erofs_fc_fill_super+0x6c0/0xcc0\n vfs_get_super+0xa9/0x140\n vfs_get_tree+0x8e/0x300\n do_new_mount+0x28c/0x580\n [...]\n\nFreed by task 5820:\n kfree+0xf1/0x2c0\n fscache_put_volume.part.0+0x5cb/0x9e0\n erofs_fscache_unregister_fs+0x157/0x1b0\n erofs_kill_sb+0xd9/0x1c0\n deactivate_locked_super+0xa3/0x100\n vfs_get_super+0x105/0x140\n vfs_get_tree+0x8e/0x300\n do_new_mount+0x28c/0x580\n [...]\n==================================================================\n\nFollowing is the process that triggers the issue:\n\n        mount failed         |         daemon exit\n------------------------------------------------------------\n deactivate_locked_super        cachefiles_daemon_release\n  erofs_kill_sb\n   erofs_fscache_unregister_fs\n    fscache_relinquish_volume\n     __fscache_relinquish_volume\n      fscache_put_volume(fscache_volume, fscache_volume_put_relinquish)\n       zero = __refcount_dec_and_test(&fscache_volume->ref, &ref);\n                                 cachefiles_put_unbind_pincount\n                                  cachefiles_daemon_unbind\n                                   cachefiles_withdraw_cache\n                                    cachefiles_withdraw_volumes\n                                     list_del_init(&volume->cache_link)\n       fscache_free_volume(fscache_volume)\n        cache->ops->free_volume\n         cachefiles_free_volume\n          list_del_init(&cachefiles_volume->cache_link);\n        kfree(fscache_volume)\n                                     cachefiles_withdraw_volume\n                                      fscache_withdraw_volume\n                                       fscache_volume->n_accesses\n                                       // fscache_volume UAF !!!\n\nThe fscache_volume in cache->volumes must not have been freed yet, but its\nreference count may be 0. So use the new fscache_try_get_volume() helper\nfunction try to get its reference count.\n\nIf the reference count of fscache_volume is 0, fscache_put_volume() is\nfreeing it, so wait for it to be removed from cache->volumes.\n\nIf its reference count is not 0, call cachefiles_withdraw_volume() with\nreference count protection to avoid the above issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\ncachefiles: fix slab-use-after-free in fscache_withdraw_volume()\n\nWe got the following issue in our fault injection stress test:\n\n==================================================================\nBUG: KASAN: slab-use-after-free in fscache_withdraw_volume+0x2e1/0x370\nRead of size 4 at addr ffff88810680be08 by task ondemand-04-dae/5798\n\nCPU: 0 PID: 5798 Comm: ondemand-04-dae Not tainted 6.8.0-dirty #565\nCall Trace:\n kasan_check_range+0xf6/0x1b0\n fscache_withdraw_volume+0x2e1/0x370\n cachefiles_withdraw_volume+0x31/0x50\n cachefiles_withdraw_cache+0x3ad/0x900\n cachefiles_put_unbind_pincount+0x1f6/0x250\n cachefiles_daemon_release+0x13b/0x290\n __fput+0x204/0xa00\n task_work_run+0x139/0x230\n\nAllocated by task 5820:\n __kmalloc+0x1df/0x4b0\n fscache_alloc_volume+0x70/0x600\n __fscache_acquire_volume+0x1c/0x610\n erofs_fscache_register_volume+0x96/0x1a0\n erofs_fscache_register_fs+0x49a/0x690\n erofs_fc_fill_super+0x6c0/0xcc0\n vfs_get_super+0xa9/0x140\n vfs_get_tree+0x8e/0x300\n do_new_mount+0x28c/0x580\n [...]\n\nFreed by task 5820:\n kfree+0xf1/0x2c0\n fscache_put_volume.part.0+0x5cb/0x9e0\n erofs_fscache_unregister_fs+0x157/0x1b0\n erofs_kill_sb+0xd9/0x1c0\n deactivate_locked_super+0xa3/0x100\n vfs_get_super+0x105/0x140\n vfs_get_tree+0x8e/0x300\n do_new_mount+0x28c/0x580\n [...]\n==================================================================\n\nFollowing is the process that triggers the issue:\n\n        mount failed         |         daemon exit\n------------------------------------------------------------\n deactivate_locked_super        cachefiles_daemon_release\n  erofs_kill_sb\n   erofs_fscache_unregister_fs\n    fscache_relinquish_volume\n     __fscache_relinquish_volume\n      fscache_put_volume(fscache_volume, fscache_volume_put_relinquish)\n       zero = __refcount_dec_and_test(&fscache_volume->ref, &ref);\n                                 cachefiles_put_unbind_pincount\n                                  cachefiles_daemon_unbind\n                                   cachefiles_withdraw_cache\n                                    cachefiles_withdraw_volumes\n                                     list_del_init(&volume->cache_link)\n       fscache_free_volume(fscache_volume)\n        cache->ops->free_volume\n         cachefiles_free_volume\n          list_del_init(&cachefiles_volume->cache_link);\n        kfree(fscache_volume)\n                                     cachefiles_withdraw_volume\n                                      fscache_withdraw_volume\n                                       fscache_volume->n_accesses\n                                       // fscache_volume UAF !!!\n\nThe fscache_volume in cache->volumes must not have been freed yet, but its\nreference count may be 0. So use the new fscache_try_get_volume() helper\nfunction try to get its reference count.\n\nIf the reference count of fscache_volume is 0, fscache_put_volume() is\nfreeing it, so wait for it to be removed from cache->volumes.\n\nIf its reference count is not 0, call cachefiles_withdraw_volume() with\nreference count protection to avoid the above issue.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se resolvió la siguiente vulnerabilidad: cachefiles: fix slab-use-after-free in fscache_withdraw_volume() Obtuvimos el siguiente problema en nuestra prueba de estrés de inyección defallos: ============ ==================================================== ==== ERROR: KASAN: slab-use-after-free en fscache_withdraw_volume+0x2e1/0x370 Lectura de tamaño 4 en la dirección ffff88810680be08 por tarea ondemand-04-dae/5798 CPU: 0 PID: 5798 Comm: ondemand-04-dae No contaminado 6.8.0-dirty #565 Seguimiento de llamadas: kasan_check_range+0xf6/0x1b0 fscache_withdraw_volume+0x2e1/0x370 cachefiles_withdraw_volume+0x31/0x50 cachefiles_withdraw_cache+0x3ad/0x900 cachefiles_put_unbind_pincount+0x1f6/0x25 0 cachefiles_daemon_release+0x13b/0x290 __fput+0x204/0xa00 task_work_run+0x139 /0x230 Asignado por la tarea 5820: __kmalloc+0x1df/0x4b0 fscache_alloc_volume+0x70/0x600 __fscache_acquire_volume+0x1c/0x610 erofs_fscache_register_volume+0x96/0x1a0 erofs_fscache_register_fs+0x49a/0 x690 erofs_fc_fill_super+0x6c0/0xcc0 vfs_get_super+0xa9/0x140 vfs_get_tree+0x8e/0x300 do_new_mount+0x28c /0x580 [...] Liberado por la tarea 5820: kfree+0xf1/0x2c0 fscache_put_volume.part.0+0x5cb/0x9e0 erofs_fscache_unregister_fs+0x157/0x1b0 erofs_kill_sb+0xd9/0x1c0 deactivate_locked_super+0xa3/0x100 _super+0x105/0x140 vfs_get_tree+0x8e/ 0x300 do_new_mount+0x28c/0x580 [...] ======================================== =========================== El siguiente es el proceso que desencadena el problema: montaje fallido | salida del daemon ------------------------------------------------ ------------ deactivate_locked_super cachefiles_daemon_release erofs_kill_sb erofs_fscache_unregister_fs fscache_relinquish_volume __fscache_relinquish_volume fscache_put_volume(fscache_volume, fscache_volume_put_relinquish) zero = __refcount_dec_and_test(&amp;fscache_volume-&gt;ref, &amp;ref); cachefiles_put_unbind_pincount cachefiles_daemon_unbind cachefiles_withdraw_cache cachefiles_withdraw_volumes list_del_init(&amp;volume-&gt;cache_link) fscache_free_volume(fscache_volume) cache-&gt;ops-&gt;free_volume cachefiles_free_volume list_del_init(&amp;cachefiles_volume-&gt;cache_link); kfree(fscache_volume) cachefiles_withdraw_volume fscache_withdraw_volume fscache_volume-&gt;n_accesses // fscache_volume UAF !!! El fscache_volume en cache-&gt;volumes no debe haberse liberado todavía, pero su recuento de referencias puede ser 0. Por lo tanto, utilice la nueva función auxiliar fscache_try_get_volume() para intentar obtener su recuento de referencias. Si el recuento de referencia de fscache_volume es 0, fscache_put_volume() lo está liberando, así que espere a que se elimine de caché-&gt;volúmenes. Si su recuento de referencias no es 0, llame a cachefiles_withdraw_volume() con protección de recuento de referencias para evitar el problema anterior.","source":"nvd"}],"published":"2024-07-29T14:57:20.894Z","modified":"2026-06-17T07:47:11.263Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-416"],"affected":[{"ranges":[{"type":"git","introduced":"fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35","fixed":"90f17e47f1e209c6a3c92a1d038a0a80c95c460e","status":"affected"},{"type":"git","introduced":"fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35","fixed":"9dd7f5663899ea13a6a73216106d9c13c37453e3","status":"affected"},{"type":"git","introduced":"fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35","fixed":"38b88d544216f806d93a273a62ff8ebe82254003","status":"affected"},{"type":"git","introduced":"fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35","fixed":"522018a0de6b6fcce60c04f86dfc5f0e4b6a1b36","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.17","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.17","status":"unaffected"},{"type":"semver","introduced":"6.1.101","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.42","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.9.11","lastAffected":"6.9.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.10","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"5.17","fixed":"6.1.101"},{"status":"affected","introduced":"6.2","fixed":"6.6.42"},{"status":"affected","introduced":"6.7","fixed":"6.9.11"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/90f17e47f1e209c6a3c92a1d038a0a80c95c460e","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/9dd7f5663899ea13a6a73216106d9c13c37453e3","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/38b88d544216f806d93a273a62ff8ebe82254003","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/522018a0de6b6fcce60c04f86dfc5f0e4b6a1b36","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-09-10T16:22:18.541Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-41058","url":"https://www.cve.org/CVERecord?id=CVE-2024-41058","licence":"CVE Terms of Use","modified":"2026-05-11T20:25:23.308Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-41058","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-41058","licence":"Public domain","modified":"2026-06-17T07:47:11.263Z"}],"updatedAt":"2026-11-25T22:58:43.309Z","epss":{"score":0.00281,"percentile":0.22112,"date":"2026-12-01T12:00:22.000Z"}}