In the Linux kernel, the following vulnerability has been resolved:
rpmsg: char: Avoid double destroy of default endpoint
The rpmsgdevremove() in rpmsg_core is the place for releasing this default endpoint.
So need to avoid destroying the default endpoint in rpmsgchrdeveptdevdestroy(), this should be the same as rpmsgeptdev_release(). Otherwise there will be double destroy issue that ept->refcount report warning:
refcount_t: underflow; use-after-free.
Call trace: refcountwarnsaturate+0xf8/0x150 virtiorpmsgdestroyept+0xd4/0xec rpmsgdev_remove+0x60/0x70
The issue can be reproduced by stopping remoteproc before closing the /dev/rpmsgX.
[
{
"id": "CVE-2022-50421-15d20137",
"target": {
"function": "rpmsg_chrdev_eptdev_destroy",
"file": "drivers/rpmsg/rpmsg_char.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3f20ef7a845c2c8d7ec82ecffa20d95cab5ecfeb",
"signature_type": "Function",
"digest": {
"function_hash": "67806604135756741912738740695147545156",
"length": 338.0
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2022-50421-6e2a71b2",
"target": {
"function": "rpmsg_chrdev_eptdev_destroy",
"file": "drivers/rpmsg/rpmsg_char.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ef828a39d6a7028836eaf37df3ad568c8c2dd6f9",
"signature_type": "Function",
"digest": {
"function_hash": "67806604135756741912738740695147545156",
"length": 338.0
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2022-50421-7012e308",
"target": {
"function": "rpmsg_chrdev_eptdev_destroy",
"file": "drivers/rpmsg/rpmsg_char.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@467233a4ac29b215d492843d067a9f091e6bf0c5",
"signature_type": "Function",
"digest": {
"function_hash": "67806604135756741912738740695147545156",
"length": 338.0
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2022-50421-752f62bb",
"target": {
"file": "drivers/rpmsg/rpmsg_char.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3f20ef7a845c2c8d7ec82ecffa20d95cab5ecfeb",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"282460863745932472355555463131454235662",
"31349249219595669565506758156419737028",
"39643949646227735841169270447377374033",
"7774210440371439177215656698786097700"
]
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2022-50421-94df40fe",
"target": {
"file": "drivers/rpmsg/rpmsg_char.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@467233a4ac29b215d492843d067a9f091e6bf0c5",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"282460863745932472355555463131454235662",
"31349249219595669565506758156419737028",
"39643949646227735841169270447377374033",
"7774210440371439177215656698786097700"
]
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2022-50421-c43933e8",
"target": {
"file": "drivers/rpmsg/rpmsg_char.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ef828a39d6a7028836eaf37df3ad568c8c2dd6f9",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"282460863745932472355555463131454235662",
"31349249219595669565506758156419737028",
"39643949646227735841169270447377374033",
"7774210440371439177215656698786097700"
]
},
"deprecated": false,
"signature_version": "v1"
}
]