{"id":"CVE-2021-47195","aliases":["CVE-2021-47195"],"related":[],"kind":"vulnerability","state":"published","title":"spi: fix use-after-free of the add_lock mutex","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nspi: fix use-after-free of the add_lock mutex\n\nCommit 6098475d4cb4 (\"spi: Fix deadlock when adding SPI controllers on\nSPI buses\") introduced a per-controller mutex. But mutex_unlock() of\nsaid lock is called after the controller is already freed:\n\n  spi_unregister_controller(ctlr)\n  -> put_device(&ctlr->dev)\n    -> spi_controller_release(dev)\n  -> mutex_unlock(&ctrl->add_lock)\n\nMove the put_device() after the mutex_unlock().","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nspi: fix use-after-free of the add_lock mutex\n\nCommit 6098475d4cb4 (\"spi: Fix deadlock when adding SPI controllers on\nSPI buses\") introduced a per-controller mutex. But mutex_unlock() of\nsaid lock is called after the controller is already freed:\n\n  spi_unregister_controller(ctlr)\n  -> put_device(&ctlr->dev)\n    -> spi_controller_release(dev)\n  -> mutex_unlock(&ctrl->add_lock)\n\nMove the put_device() after the mutex_unlock().","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se resolvió la siguiente vulnerabilidad: spi: corrige el use-after-free del mutex add_lock. El commit 6098475d4cb4 (\"spi: corrige el punto muerto al agregar controladores SPI en buses SPI\") introdujo un mutex por controlador. Pero mutex_unlock() de dicho bloqueo se llama después de que el controlador ya está liberado: spi_unregister_controller(ctlr) -&gt; put_device(&amp;ctlr-&gt;dev) -&gt; spi_controller_release(dev) -&gt; mutex_unlock(&amp;ctrl-&gt;add_lock) Mueva put_device() después el mutex_unlock().","source":"nvd"}],"published":"2024-04-10T18:56:31.999Z","modified":"2026-06-17T04:16:53.067Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-416"],"affected":[{"ranges":[{"type":"git","introduced":"aa3f3d7bef59583f2d3234173105a27ff61ef8fe","fixed":"54c2c96eafcfd242e52e932ab54ace4784efe1dd","status":"affected"},{"type":"git","introduced":"c8dce228db6f81dbc897a018dfc5c418e917cf64","fixed":"11eab327a2a8bd36c38afbff920ae1bd45588dd4","status":"affected"},{"type":"git","introduced":"6098475d4cb48d821bdf453c61118c56e26294f0","fixed":"37330f37f6666c7739a44b2b6b95b047ccdbed2d","status":"affected"},{"type":"git","introduced":"6098475d4cb48d821bdf453c61118c56e26294f0","fixed":"6c53b45c71b4920b5e62f0ea8079a1da382b9434","status":"affected"},{"type":"git","version":"722ef19a161ce3fffb3d1b01ce2301c306639bdd","status":"affected"},{"type":"semver","introduced":"5.14.15","fixed":"5.15","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.15","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.15","status":"unaffected"},{"type":"semver","introduced":"5.15.5","lastAffected":"5.15.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"5.16","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.15.0","fixed":"5.15.5"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/54c2c96eafcfd242e52e932ab54ace4784efe1dd","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/11eab327a2a8bd36c38afbff920ae1bd45588dd4","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/37330f37f6666c7739a44b2b6b95b047ccdbed2d","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/6c53b45c71b4920b5e62f0ea8079a1da382b9434","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-04-10T19:52:25.727Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-47195","url":"https://www.cve.org/CVERecord?id=CVE-2021-47195","licence":"CVE Terms of Use","modified":"2026-05-23T15:19:30.977Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-47195","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-47195","licence":"Public domain","modified":"2026-06-17T04:16:53.067Z"}],"updatedAt":"2026-11-25T22:58:08.712Z","epss":{"score":0.00219,"percentile":0.13148,"date":"2026-12-01T12:00:22.000Z"}}