In the Linux kernel, the following vulnerability has been resolved:
mmc: sdio: fix possible resource leaks in some error paths
If sdioaddfunc() or sdioinitfunc() fails, sdioremovefunc() can not release the resources, because the sdio function is not presented in these two cases, it won't call ofnodeput() or put_device().
To fix these leaks, make sdiofuncpresent() only control whether devicedel() needs to be called or not, then always call ofnodeput() and putdevice().
In error case in sdioinitfunc(), the reference of 'card->dev' is not get, to avoid redundant put in sdiofreefunccis(), move the getdevice() to sdioallocfunc() and putdevice() to sdiorelease_func(), it can keep the get/put function be balanced.
Without this patch, while doing fault inject test, it can get the following leak reports, after this fix, the leak is gone.
unreferenced object 0xffff888112514000 (size 2048): comm "kworker/3:2", pid 65, jiffies 4294741614 (age 124.774s) hex dump (first 32 bytes): 00 e0 6f 12 81 88 ff ff 60 58 8d 06 81 88 ff ff ..o.....`X...... 10 40 51 12 81 88 ff ff 10 40 51 12 81 88 ff ff .@Q......@Q..... backtrace: [<000000009e5931da>] kmalloctrace+0x21/0x110 [<000000002f839ccb>] mmcalloccard+0x38/0xb0 [mmccore] [<0000000004adcbf6>] mmcsdioinitcard+0xde/0x170 [mmccore] [<000000007538fea0>] mmcattachsdio+0xcb/0x1b0 [mmccore] [<00000000d4fdeba7>] mmcrescan+0x54a/0x640 [mmc_core]
unreferenced object 0xffff888112511000 (size 2048): comm "kworker/3:2", pid 65, jiffies 4294741623 (age 124.766s) hex dump (first 32 bytes): 00 40 51 12 81 88 ff ff e0 58 8d 06 81 88 ff ff .@Q......X...... 10 10 51 12 81 88 ff ff 10 10 51 12 81 88 ff ff ..Q.......Q..... backtrace: [<000000009e5931da>] kmalloctrace+0x21/0x110 [<00000000fcbe706c>] sdioallocfunc+0x35/0x100 [mmccore] [<00000000c68f4b50>] mmcattachsdio.cold.18+0xb1/0x395 [mmccore] [<00000000d4fdeba7>] mmcrescan+0x54a/0x640 [mmc_core]
{
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/52xxx/CVE-2023-52730.json"
}[
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"154757761826434337264753692920983902361",
"8006941005386157601313269714337910566",
"164381362011603779611497474475056299201",
"117681717909167092306814859026377361744",
"235112621755330773502358758586046343229",
"208352453877883372589876278901703135491"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5c7858adada31dbed042448cff6997dd6efc472a",
"deprecated": false,
"id": "CVE-2023-52730-044e5c1e",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"154757761826434337264753692920983902361",
"8006941005386157601313269714337910566",
"164381362011603779611497474475056299201",
"117681717909167092306814859026377361744",
"235112621755330773502358758586046343229",
"208352453877883372589876278901703135491"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f855d31bb38d663c3ba672345d7cce9324ba3b72",
"deprecated": false,
"id": "CVE-2023-52730-1d0ee512",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 453.0,
"function_hash": "100386646541945008422467781557887358423"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e06cf04239e202248c8fa356bf11449dc73cfbd",
"deprecated": false,
"id": "CVE-2023-52730-2071ba62",
"signature_type": "Function",
"target": {
"function": "sdio_alloc_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 453.0,
"function_hash": "100386646541945008422467781557887358423"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@30716d9f0fa1766e522cf24c8a456244e4fc9931",
"deprecated": false,
"id": "CVE-2023-52730-24b44459",
"signature_type": "Function",
"target": {
"function": "sdio_alloc_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 248.0,
"function_hash": "9251352948709868281103711109515427260"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@30716d9f0fa1766e522cf24c8a456244e4fc9931",
"deprecated": false,
"id": "CVE-2023-52730-2e42d69a",
"signature_type": "Function",
"target": {
"function": "sdio_free_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 231.0,
"function_hash": "313035339447628902617751518237560880272"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f855d31bb38d663c3ba672345d7cce9324ba3b72",
"deprecated": false,
"id": "CVE-2023-52730-401c8575",
"signature_type": "Function",
"target": {
"function": "sdio_release_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 296.0,
"function_hash": "209065151643777032609479187077556767542"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@605d9fb9556f8f5fb4566f4df1480f280f308ded",
"deprecated": false,
"id": "CVE-2023-52730-4156601b",
"signature_type": "Function",
"target": {
"function": "sdio_read_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 248.0,
"function_hash": "9251352948709868281103711109515427260"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f855d31bb38d663c3ba672345d7cce9324ba3b72",
"deprecated": false,
"id": "CVE-2023-52730-41c0c898",
"signature_type": "Function",
"target": {
"function": "sdio_free_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 171.0,
"function_hash": "27112439276119970117224623468872542414"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e06cf04239e202248c8fa356bf11449dc73cfbd",
"deprecated": false,
"id": "CVE-2023-52730-5adec681",
"signature_type": "Function",
"target": {
"function": "sdio_remove_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 453.0,
"function_hash": "100386646541945008422467781557887358423"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@605d9fb9556f8f5fb4566f4df1480f280f308ded",
"deprecated": false,
"id": "CVE-2023-52730-6b5004fe",
"signature_type": "Function",
"target": {
"function": "sdio_alloc_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"92773607593603315452012748360316575667",
"156853090579900001511859786454282166568",
"270612808877004881667707340780911247141",
"267883540144802466135515384896233310812",
"17917402866882335526555173262297043343",
"314053315726736589356944080916106048559",
"137447864670920526652716171363724288207",
"164015438220854780294877408901650227411",
"179490398583846745404792923268215941836",
"182050438492885989854572613593187953780",
"337672824154553066667229715827259433561",
"105425822772848429362389905890181895932"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e06cf04239e202248c8fa356bf11449dc73cfbd",
"deprecated": false,
"id": "CVE-2023-52730-6ef95ca4",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 171.0,
"function_hash": "27112439276119970117224623468872542414"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@605d9fb9556f8f5fb4566f4df1480f280f308ded",
"deprecated": false,
"id": "CVE-2023-52730-73ffbc53",
"signature_type": "Function",
"target": {
"function": "sdio_remove_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 231.0,
"function_hash": "313035339447628902617751518237560880272"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5c7858adada31dbed042448cff6997dd6efc472a",
"deprecated": false,
"id": "CVE-2023-52730-82b52204",
"signature_type": "Function",
"target": {
"function": "sdio_release_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 248.0,
"function_hash": "9251352948709868281103711109515427260"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5c7858adada31dbed042448cff6997dd6efc472a",
"deprecated": false,
"id": "CVE-2023-52730-88f58c3f",
"signature_type": "Function",
"target": {
"function": "sdio_free_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 296.0,
"function_hash": "209065151643777032609479187077556767542"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@30716d9f0fa1766e522cf24c8a456244e4fc9931",
"deprecated": false,
"id": "CVE-2023-52730-963c0764",
"signature_type": "Function",
"target": {
"function": "sdio_read_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"92773607593603315452012748360316575667",
"156853090579900001511859786454282166568",
"270612808877004881667707340780911247141",
"267883540144802466135515384896233310812",
"17917402866882335526555173262297043343",
"314053315726736589356944080916106048559",
"137447864670920526652716171363724288207",
"164015438220854780294877408901650227411",
"179490398583846745404792923268215941836",
"182050438492885989854572613593187953780",
"337672824154553066667229715827259433561",
"105425822772848429362389905890181895932"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5c7858adada31dbed042448cff6997dd6efc472a",
"deprecated": false,
"id": "CVE-2023-52730-97750a8e",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 171.0,
"function_hash": "27112439276119970117224623468872542414"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5c7858adada31dbed042448cff6997dd6efc472a",
"deprecated": false,
"id": "CVE-2023-52730-a6eb0dc8",
"signature_type": "Function",
"target": {
"function": "sdio_remove_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 231.0,
"function_hash": "313035339447628902617751518237560880272"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@30716d9f0fa1766e522cf24c8a456244e4fc9931",
"deprecated": false,
"id": "CVE-2023-52730-aa928ba9",
"signature_type": "Function",
"target": {
"function": "sdio_release_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"154757761826434337264753692920983902361",
"8006941005386157601313269714337910566",
"164381362011603779611497474475056299201",
"117681717909167092306814859026377361744",
"235112621755330773502358758586046343229",
"208352453877883372589876278901703135491"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@30716d9f0fa1766e522cf24c8a456244e4fc9931",
"deprecated": false,
"id": "CVE-2023-52730-aa92b776",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"154757761826434337264753692920983902361",
"8006941005386157601313269714337910566",
"164381362011603779611497474475056299201",
"117681717909167092306814859026377361744",
"235112621755330773502358758586046343229",
"208352453877883372589876278901703135491"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@605d9fb9556f8f5fb4566f4df1480f280f308ded",
"deprecated": false,
"id": "CVE-2023-52730-bbb3ba41",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"154757761826434337264753692920983902361",
"8006941005386157601313269714337910566",
"164381362011603779611497474475056299201",
"117681717909167092306814859026377361744",
"235112621755330773502358758586046343229",
"208352453877883372589876278901703135491"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e06cf04239e202248c8fa356bf11449dc73cfbd",
"deprecated": false,
"id": "CVE-2023-52730-c556ed0d",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 171.0,
"function_hash": "27112439276119970117224623468872542414"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f855d31bb38d663c3ba672345d7cce9324ba3b72",
"deprecated": false,
"id": "CVE-2023-52730-c9abae06",
"signature_type": "Function",
"target": {
"function": "sdio_remove_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 231.0,
"function_hash": "313035339447628902617751518237560880272"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e06cf04239e202248c8fa356bf11449dc73cfbd",
"deprecated": false,
"id": "CVE-2023-52730-ce32ca58",
"signature_type": "Function",
"target": {
"function": "sdio_release_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 296.0,
"function_hash": "209065151643777032609479187077556767542"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5c7858adada31dbed042448cff6997dd6efc472a",
"deprecated": false,
"id": "CVE-2023-52730-d78ae710",
"signature_type": "Function",
"target": {
"function": "sdio_read_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 453.0,
"function_hash": "100386646541945008422467781557887358423"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5c7858adada31dbed042448cff6997dd6efc472a",
"deprecated": false,
"id": "CVE-2023-52730-d81a216f",
"signature_type": "Function",
"target": {
"function": "sdio_alloc_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 171.0,
"function_hash": "27112439276119970117224623468872542414"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@30716d9f0fa1766e522cf24c8a456244e4fc9931",
"deprecated": false,
"id": "CVE-2023-52730-df31ff30",
"signature_type": "Function",
"target": {
"function": "sdio_remove_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 231.0,
"function_hash": "313035339447628902617751518237560880272"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@605d9fb9556f8f5fb4566f4df1480f280f308ded",
"deprecated": false,
"id": "CVE-2023-52730-df7fa45d",
"signature_type": "Function",
"target": {
"function": "sdio_release_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 296.0,
"function_hash": "209065151643777032609479187077556767542"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f855d31bb38d663c3ba672345d7cce9324ba3b72",
"deprecated": false,
"id": "CVE-2023-52730-df9b44f7",
"signature_type": "Function",
"target": {
"function": "sdio_read_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"92773607593603315452012748360316575667",
"156853090579900001511859786454282166568",
"270612808877004881667707340780911247141",
"267883540144802466135515384896233310812",
"17917402866882335526555173262297043343",
"314053315726736589356944080916106048559",
"137447864670920526652716171363724288207",
"164015438220854780294877408901650227411",
"179490398583846745404792923268215941836",
"182050438492885989854572613593187953780",
"337672824154553066667229715827259433561",
"105425822772848429362389905890181895932"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f855d31bb38d663c3ba672345d7cce9324ba3b72",
"deprecated": false,
"id": "CVE-2023-52730-e1ab5881",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 248.0,
"function_hash": "9251352948709868281103711109515427260"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@605d9fb9556f8f5fb4566f4df1480f280f308ded",
"deprecated": false,
"id": "CVE-2023-52730-edc7e33a",
"signature_type": "Function",
"target": {
"function": "sdio_free_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 453.0,
"function_hash": "100386646541945008422467781557887358423"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f855d31bb38d663c3ba672345d7cce9324ba3b72",
"deprecated": false,
"id": "CVE-2023-52730-ee47979a",
"signature_type": "Function",
"target": {
"function": "sdio_alloc_func",
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 248.0,
"function_hash": "9251352948709868281103711109515427260"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e06cf04239e202248c8fa356bf11449dc73cfbd",
"deprecated": false,
"id": "CVE-2023-52730-f3cd9f3e",
"signature_type": "Function",
"target": {
"function": "sdio_free_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"92773607593603315452012748360316575667",
"156853090579900001511859786454282166568",
"270612808877004881667707340780911247141",
"267883540144802466135515384896233310812",
"17917402866882335526555173262297043343",
"314053315726736589356944080916106048559",
"137447864670920526652716171363724288207",
"164015438220854780294877408901650227411",
"179490398583846745404792923268215941836",
"182050438492885989854572613593187953780",
"337672824154553066667229715827259433561",
"105425822772848429362389905890181895932"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@30716d9f0fa1766e522cf24c8a456244e4fc9931",
"deprecated": false,
"id": "CVE-2023-52730-fcb07d85",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
},
{
"digest": {
"length": 296.0,
"function_hash": "209065151643777032609479187077556767542"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e06cf04239e202248c8fa356bf11449dc73cfbd",
"deprecated": false,
"id": "CVE-2023-52730-fd4e6efb",
"signature_type": "Function",
"target": {
"function": "sdio_read_func_cis",
"file": "drivers/mmc/core/sdio_cis.c"
},
"signature_version": "v1"
},
{
"digest": {
"threshold": 0.9,
"line_hashes": [
"92773607593603315452012748360316575667",
"156853090579900001511859786454282166568",
"270612808877004881667707340780911247141",
"267883540144802466135515384896233310812",
"17917402866882335526555173262297043343",
"314053315726736589356944080916106048559",
"137447864670920526652716171363724288207",
"164015438220854780294877408901650227411",
"179490398583846745404792923268215941836",
"182050438492885989854572613593187953780",
"337672824154553066667229715827259433561",
"105425822772848429362389905890181895932"
]
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@605d9fb9556f8f5fb4566f4df1480f280f308ded",
"deprecated": false,
"id": "CVE-2023-52730-fdf28a2d",
"signature_type": "Line",
"target": {
"file": "drivers/mmc/core/sdio_bus.c"
},
"signature_version": "v1"
}
]
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-52730.json"