{"id":"CVE-2021-47158","state":"PUBLISHED","title":"net: dsa: sja1105: add error handling in sja1105_setup()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: dsa: sja1105: add error handling in sja1105_setup()\n\nIf any of sja1105_static_config_load(), sja1105_clocking_setup() or\nsja1105_devlink_setup() fails, we can't just return in the middle of\nsja1105_setup() or memory will leak. Add a cleanup path.","publishedAt":"2024-03-25T09:16:13.087Z","updatedAt":"2026-08-05T08:46:22.882Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8aa9ebccae87621d997707e4f25e53fddd7e30e4","status":"affected","lessThan":"dd8609f203448ca6d58ae71461208b3f6b0329b0","versionType":"git"},{"version":"8aa9ebccae87621d997707e4f25e53fddd7e30e4","status":"affected","lessThan":"987e4ab8b8a4fcbf783069e03e7524cd39ffd563","versionType":"git"},{"version":"8aa9ebccae87621d997707e4f25e53fddd7e30e4","status":"affected","lessThan":"cec279a898a3b004411682f212215ccaea1cd0fb","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/dsa/sja1105/sja1105_main.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.2","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.2","versionType":"semver"},{"version":"5.10.42","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.12.9","status":"unaffected","lessThanOrEqual":"5.12.*","versionType":"semver"},{"version":"5.13","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/dsa/sja1105/sja1105_main.c"]}],"references":["https://git.kernel.org/stable/c/dd8609f203448ca6d58ae71461208b3f6b0329b0","https://git.kernel.org/stable/c/987e4ab8b8a4fcbf783069e03e7524cd39ffd563","https://git.kernel.org/stable/c/cec279a898a3b004411682f212215ccaea1cd0fb"],"weaknesses":[],"ingestedAt":"2026-10-29T19:49:19.404Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2021/47xxx/CVE-2021-47158.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2021-47158","state":"PUBLISHED","datePublished":"2024-03-25T09:16:13.087Z","dateUpdated":"2026-08-05T08:46:22.882Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-03-25T09:12:14.109Z"},"containers":{"cna":{"title":"net: dsa: sja1105: add error handling in sja1105_setup()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: dsa: sja1105: add error handling in sja1105_setup()\n\nIf any of sja1105_static_config_load(), sja1105_clocking_setup() or\nsja1105_devlink_setup() fails, we can't just return in the middle of\nsja1105_setup() or memory will leak. Add a cleanup path."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8aa9ebccae87621d997707e4f25e53fddd7e30e4","status":"affected","lessThan":"dd8609f203448ca6d58ae71461208b3f6b0329b0","versionType":"git"},{"version":"8aa9ebccae87621d997707e4f25e53fddd7e30e4","status":"affected","lessThan":"987e4ab8b8a4fcbf783069e03e7524cd39ffd563","versionType":"git"},{"version":"8aa9ebccae87621d997707e4f25e53fddd7e30e4","status":"affected","lessThan":"cec279a898a3b004411682f212215ccaea1cd0fb","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/dsa/sja1105/sja1105_main.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.2","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.2","versionType":"semver"},{"version":"5.10.42","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.12.9","status":"unaffected","lessThanOrEqual":"5.12.*","versionType":"semver"},{"version":"5.13","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/dsa/sja1105/sja1105_main.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/dd8609f203448ca6d58ae71461208b3f6b0329b0"},{"url":"https://git.kernel.org/stable/c/987e4ab8b8a4fcbf783069e03e7524cd39ffd563"},{"url":"https://git.kernel.org/stable/c/cec279a898a3b004411682f212215ccaea1cd0fb"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The bug is in the SJA1105 SPI DSA driver probe path (sja1105_probe → dsa_register_switch → sja1105_setup), not in packet processing; exploitation is local via driver (re)bind failure and subsequent access to the leftover /dev/ptpN device.\nAC:L - The error path is deterministic once static_config_load/clocking_setup/devlink_setup fails after PTP registration (e.g., -ENOMEM or SPI failure), and the resulting dangling PTP clock can be exercised reliably through standard PTP ioctls with no race beyond attacker influence.\nPR:L - On automotive/industrial SJA1105 systems, a mid-setup failure leaves a registered PTP clock after demv frees priv; an unprivileged local user who can open /dev/ptpN (ptp_open has no capability check) can then trigger the UAF without needing CAP_SYS_ADMIN.\nUI:N - No victim action is required; the attacker drives probe-failure conditions and/or opens the dangling PTP device and issues ioctls themselves.\nS:U - Impact is confined to kernel memory corruption within the same host kernel authority; this is not a VM escape, IOMMU bypass, or other cross-boundary break.\nC:H - After demv releases priv while ptp->info still points into it, PTP ioctls (e.g. GETCAPS/gettime) dereference freed ptp_clock_info, yielding a UAF that can be reclaimed and read for arbitrary kernel memory disclosure.\nI:H - The dangling ptp_clock_info holds function pointers (adjfine/gettimex64/settime64/etc.) in freed heap; heap reuse enables control-flow hijacking through those callbacks, so integrity impact is High.\nA:H - Use-after-free on the freed priv/ptp_data (and related timer/worker state) causes kernel oops/crash even without full exploitation, so availability impact is High."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T08:46:22.882Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.2","versionEndExcluding":"5.10.42"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.2","versionEndExcluding":"5.12.9"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.2","versionEndExcluding":"5.13"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/dd8609f203448ca6d58ae71461208b3f6b0329b0","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/987e4ab8b8a4fcbf783069e03e7524cd39ffd563","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/cec279a898a3b004411682f212215ccaea1cd0fb","tags":["x_transferred"]}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2024-08-04T05:24:39.943Z"}},{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2021-47158","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2024-09-10T15:54:47.842191Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2024-09-11T17:33:55.376Z"}}]}}}