{"id":"CVE-2022-50421","state":"PUBLISHED","title":"rpmsg: char: Avoid double destroy of default endpoint","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nrpmsg: char: Avoid double destroy of default endpoint\n\nThe rpmsg_dev_remove() in rpmsg_core is the place for releasing\nthis default endpoint.\n\nSo need to avoid destroying the default endpoint in\nrpmsg_chrdev_eptdev_destroy(), this should be the same as\nrpmsg_eptdev_release(). Otherwise there will be double destroy\nissue that ept->refcount report warning:\n\nrefcount_t: underflow; use-after-free.\n\nCall trace:\n refcount_warn_saturate+0xf8/0x150\n virtio_rpmsg_destroy_ept+0xd4/0xec\n rpmsg_dev_remove+0x60/0x70\n\nThe issue can be reproduced by stopping remoteproc before\nclosing the /dev/rpmsgX.","publishedAt":"2025-10-01T11:41:54.351Z","updatedAt":"2026-08-05T08:58:44.673Z","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":"bea9b79c2d10fecf7bfa26e212ecefe61d232e39","status":"affected","lessThan":"ef828a39d6a7028836eaf37df3ad568c8c2dd6f9","versionType":"git"},{"version":"bea9b79c2d10fecf7bfa26e212ecefe61d232e39","status":"affected","lessThan":"3f20ef7a845c2c8d7ec82ecffa20d95cab5ecfeb","versionType":"git"},{"version":"bea9b79c2d10fecf7bfa26e212ecefe61d232e39","status":"affected","lessThan":"467233a4ac29b215d492843d067a9f091e6bf0c5","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/rpmsg/rpmsg_char.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.18","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.18","versionType":"semver"},{"version":"5.19.17","status":"unaffected","lessThanOrEqual":"5.19.*","versionType":"semver"},{"version":"6.0.3","status":"unaffected","lessThanOrEqual":"6.0.*","versionType":"semver"},{"version":"6.1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/rpmsg/rpmsg_char.c"]}],"references":["https://git.kernel.org/stable/c/ef828a39d6a7028836eaf37df3ad568c8c2dd6f9","https://git.kernel.org/stable/c/3f20ef7a845c2c8d7ec82ecffa20d95cab5ecfeb","https://git.kernel.org/stable/c/467233a4ac29b215d492843d067a9f091e6bf0c5"],"weaknesses":["CWE-416"],"ingestedAt":"2026-10-29T20:05:26.763Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2022/50xxx/CVE-2022-50421.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2022-50421","state":"PUBLISHED","datePublished":"2025-10-01T11:41:54.351Z","dateUpdated":"2026-08-05T08:58:44.673Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-09-17T14:53:07.004Z"},"containers":{"cna":{"title":"rpmsg: char: Avoid double destroy of default endpoint","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nrpmsg: char: Avoid double destroy of default endpoint\n\nThe rpmsg_dev_remove() in rpmsg_core is the place for releasing\nthis default endpoint.\n\nSo need to avoid destroying the default endpoint in\nrpmsg_chrdev_eptdev_destroy(), this should be the same as\nrpmsg_eptdev_release(). Otherwise there will be double destroy\nissue that ept->refcount report warning:\n\nrefcount_t: underflow; use-after-free.\n\nCall trace:\n refcount_warn_saturate+0xf8/0x150\n virtio_rpmsg_destroy_ept+0xd4/0xec\n rpmsg_dev_remove+0x60/0x70\n\nThe issue can be reproduced by stopping remoteproc before\nclosing the /dev/rpmsgX."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"bea9b79c2d10fecf7bfa26e212ecefe61d232e39","status":"affected","lessThan":"ef828a39d6a7028836eaf37df3ad568c8c2dd6f9","versionType":"git"},{"version":"bea9b79c2d10fecf7bfa26e212ecefe61d232e39","status":"affected","lessThan":"3f20ef7a845c2c8d7ec82ecffa20d95cab5ecfeb","versionType":"git"},{"version":"bea9b79c2d10fecf7bfa26e212ecefe61d232e39","status":"affected","lessThan":"467233a4ac29b215d492843d067a9f091e6bf0c5","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/rpmsg/rpmsg_char.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.18","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.18","versionType":"semver"},{"version":"5.19.17","status":"unaffected","lessThanOrEqual":"5.19.*","versionType":"semver"},{"version":"6.0.3","status":"unaffected","lessThanOrEqual":"6.0.*","versionType":"semver"},{"version":"6.1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/rpmsg/rpmsg_char.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/ef828a39d6a7028836eaf37df3ad568c8c2dd6f9"},{"url":"https://git.kernel.org/stable/c/3f20ef7a845c2c8d7ec82ecffa20d95cab5ecfeb"},{"url":"https://git.kernel.org/stable/c/467233a4ac29b215d492843d067a9f091e6bf0c5"}],"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 vulnerable path is reached only through local rpmsg char device operations (/dev/rpmsgX open plus channel/device teardown via remoteproc stop, NS_DESTROY, or RPMSG_RELEASE_DEV_IOCTL); it is not reachable from network packets or adjacent-link protocols.\nAC:L - With /dev/rpmsgX held open on a default_ept (rpmsg-raw) channel, device removal deterministically double-destroys the same endpoint in rpmsg_chrdev_eptdev_destroy then rpmsg_dev_remove; the attacker who opens the device and triggers teardown fully controls both steps with no race or external precondition.\nPR:L - On the platforms where RPMSG_CHAR is actually deployed (Android/QCOM, automotive, OpenAMP embedded), /dev/rpmsg* is routinely granted to non-root HALs/service users via udev/sepolicy, and those same contexts can drive channel release or remoteproc restart without full init-namespace root.\nUI:N - The attacker opens /dev/rpmsgX and triggers device removal themselves; no separate victim action such as mounting a filesystem or opening a crafted file is required.\nS:U - Impact is a host-kernel heap use-after-free of the rpmsg_endpoint within the same OS security authority, with no VM escape, IOMMU bypass, or other cross-boundary compromise.\nC:H - The first rpmsg_destroy_ept kfree's the default endpoint while rpdev->ept still points at it, so the second destroy is a classic UAF on a reclaimable slab object that per guidance enables arbitrary kernel memory disclosure.\nI:H - The same freed rpmsg_endpoint can be sprayed before the second destroy walks ept->ops/rpdev/refcount, yielding a heap corruption and control-flow hijack primitive consistent with UAF integrity High.\nA:H - The bug manifests as refcount underflow use-after-free (and kernel oops under KASAN); per guidance any UAF scores Availability High even when not fully exploited for code execution."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T08:58:44.673Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.18","versionEndExcluding":"5.19.17"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.18","versionEndExcluding":"6.0.3"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.18","versionEndExcluding":"6.1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"cvssV3_1":{"scope":"UNCHANGED","version":"3.1","baseScore":7.8,"attackVector":"LOCAL","baseSeverity":"HIGH","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","integrityImpact":"HIGH","userInteraction":"NONE","attackComplexity":"LOW","availabilityImpact":"HIGH","privilegesRequired":"LOW","confidentialityImpact":"HIGH"}},{"other":{"type":"ssvc","content":{"id":"CVE-2022-50421","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2026-01-14T17:39:44.735824Z"}}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-416","lang":"en","type":"CWE","description":"CWE-416 Use After Free"}]}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-01-14T17:42:46.316Z"}}]}}}