In the Linux kernel, the following vulnerability has been resolved:
cpufreq: governor: Use kobject release() method to free dbs_data
The struct dbsdata embeds a struct govattrset and the struct govattrset embeds a kobject. Since every kobject must have a release() method and we can't use kfree() to free it directly, so introduce cpufreqdbsdatarelease() to release the dbs_data via the kobject::release() method. This fixes the calltrace like below:
ODEBUG: free active (active state 0) object type: timerlist hint: delayedworktimerfn+0x0/0x34 WARNING: CPU: 12 PID: 810 at lib/debugobjects.c:505 debugprintobject+0xb8/0x100 Modules linked in: CPU: 12 PID: 810 Comm: sh Not tainted 5.16.0-next-20220120-yocto-standard+ #536 Hardware name: Marvell OcteonTX CN96XX board (DT) pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : debugprintobject+0xb8/0x100 lr : debugprintobject+0xb8/0x100 sp : ffff80001dfcf9a0 x29: ffff80001dfcf9a0 x28: 0000000000000001 x27: ffff0001464f0000 x26: 0000000000000000 x25: ffff8000090e3f00 x24: ffff80000af60210 x23: ffff8000094dfb78 x22: ffff8000090e3f00 x21: ffff0001080b7118 x20: ffff80000aeb2430 x19: ffff800009e8f5e0 x18: 0000000000000000 x17: 0000000000000002 x16: 00004d62e58be040 x15: 013590470523aff8 x14: ffff8000090e1828 x13: 0000000001359047 x12: 00000000f5257d14 x11: 0000000000040591 x10: 0000000066c1ffea x9 : ffff8000080d15e0 x8 : ffff80000a1765a8 x7 : 0000000000000000 x6 : 0000000000000001 x5 : ffff800009e8c000 x4 : ffff800009e8c760 x3 : 0000000000000000 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0001474ed040 Call trace: debugprintobject+0xb8/0x100 _debugchecknoobjfreed+0x1d0/0x25c debugchecknoobjfreed+0x24/0xa0 kfree+0x11c/0x440 cpufreqdbsgovernorexit+0xa8/0xac cpufreqexitgovernor+0x44/0x90 cpufreqsetpolicy+0x29c/0x570 storescalinggovernor+0x110/0x154 store+0xb0/0xe0 sysfskfwrite+0x58/0x84 kernfsfopwriteiter+0x12c/0x1c0 newsyncwrite+0xf0/0x18c vfswrite+0x1cc/0x220 ksyswrite+0x74/0x100 _arm64syswrite+0x28/0x3c invokesyscall.constprop.0+0x58/0xf0 doel0svc+0x70/0x170 el0svc+0x54/0x190 el0t64synchandler+0xa4/0x130 el0t64sync+0x1a0/0x1a4 irq event stamp: 189006 hardirqs last enabled at (189005): [<ffff8000080849d0>] finishtaskswitch.isra.0+0xe0/0x2c0 hardirqs last disabled at (189006): [<ffff8000090667a4>] el1dbg+0x24/0xa0 softirqs last enabled at (188966): [<ffff8000080106d0>] _dosoftirq+0x4b0/0x6a0 softirqs last disabled at (188957): [<ffff80000804a618>] _irqexit_rcu+0x108/0x1a4
[ rjw: Because can be freed by the govattrsetput() in cpufreqdbsgovernorexit() now, it is also necessary to put the invocation of the governor ->exit() callback into the new cpufreqdbsdata_release() function. ]
[
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1964688582d26af1328e19b658933659fb54337",
"target": {
"function": "cpufreq_dbs_governor_init",
"file": "drivers/cpufreq/cpufreq_governor.c"
},
"deprecated": false,
"id": "CVE-2022-49513-219cd7ef",
"signature_version": "v1",
"digest": {
"length": 1442.0,
"function_hash": "247604902300510276389057964352383385046"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e32083f327184b6226ce320ef30085ce785ea4e",
"target": {
"function": "cpufreq_dbs_governor_init",
"file": "drivers/cpufreq/cpufreq_governor.c"
},
"deprecated": false,
"id": "CVE-2022-49513-3600fc72",
"signature_version": "v1",
"digest": {
"length": 1442.0,
"function_hash": "247604902300510276389057964352383385046"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1964688582d26af1328e19b658933659fb54337",
"target": {
"function": "cpufreq_dbs_governor_exit",
"file": "drivers/cpufreq/cpufreq_governor.c"
},
"deprecated": false,
"id": "CVE-2022-49513-53329661",
"signature_version": "v1",
"digest": {
"length": 448.0,
"function_hash": "210923104967053377498336130001346880136"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1964688582d26af1328e19b658933659fb54337",
"target": {
"file": "drivers/cpufreq/cpufreq_governor.c"
},
"deprecated": false,
"id": "CVE-2022-49513-64300bdb",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"154174298802360304472583911781340568540",
"58974010362398033499281068323644935582",
"60420354471350014150720086729814102511",
"207270700593686482530265839725945751755",
"266549150513241696222801737885339244635",
"251590044858264526802883952857007718111",
"244572163843800201545292567196663860694",
"60034713997428596437332274742544774312",
"130462470823445068559242873828665814964",
"68304590887479902773437125723586512508",
"200019732397606776397194030930843615374",
"239927300807417866894619669993825920658",
"24013743639702157658340651822771011843",
"129511553131132172575742280441319536878",
"262832998498498803243717591275635800539",
"247208081227086449254026634750627059191",
"172037979715441734486235423647709747123",
"178273799220418069638413521257780781703",
"247211286320299839205363046107372509694"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1964688582d26af1328e19b658933659fb54337",
"target": {
"file": "drivers/cpufreq/cpufreq_governor.h"
},
"deprecated": false,
"id": "CVE-2022-49513-7761cf8e",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"97482840261710202828708080551948861133",
"267759966117310483009607805191040636925",
"100500616241165190150886579127864505112",
"179032359837774268834711821195292390805"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e32083f327184b6226ce320ef30085ce785ea4e",
"target": {
"function": "cpufreq_dbs_governor_exit",
"file": "drivers/cpufreq/cpufreq_governor.c"
},
"deprecated": false,
"id": "CVE-2022-49513-8a01ebd3",
"signature_version": "v1",
"digest": {
"length": 448.0,
"function_hash": "210923104967053377498336130001346880136"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a85ee6401a47ae3fc64ba506cacb3e7873823c65",
"target": {
"function": "cpufreq_dbs_governor_exit",
"file": "drivers/cpufreq/cpufreq_governor.c"
},
"deprecated": false,
"id": "CVE-2022-49513-930c7807",
"signature_version": "v1",
"digest": {
"length": 448.0,
"function_hash": "210923104967053377498336130001346880136"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a85ee6401a47ae3fc64ba506cacb3e7873823c65",
"target": {
"file": "drivers/cpufreq/cpufreq_governor.c"
},
"deprecated": false,
"id": "CVE-2022-49513-99016fd2",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"154174298802360304472583911781340568540",
"58974010362398033499281068323644935582",
"60420354471350014150720086729814102511",
"207270700593686482530265839725945751755",
"266549150513241696222801737885339244635",
"251590044858264526802883952857007718111",
"244572163843800201545292567196663860694",
"60034713997428596437332274742544774312",
"130462470823445068559242873828665814964",
"68304590887479902773437125723586512508",
"200019732397606776397194030930843615374",
"239927300807417866894619669993825920658",
"24013743639702157658340651822771011843",
"129511553131132172575742280441319536878",
"262832998498498803243717591275635800539",
"247208081227086449254026634750627059191",
"172037979715441734486235423647709747123",
"178273799220418069638413521257780781703",
"247211286320299839205363046107372509694"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e32083f327184b6226ce320ef30085ce785ea4e",
"target": {
"file": "drivers/cpufreq/cpufreq_governor.h"
},
"deprecated": false,
"id": "CVE-2022-49513-a744ee6b",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"97482840261710202828708080551948861133",
"267759966117310483009607805191040636925",
"100500616241165190150886579127864505112",
"179032359837774268834711821195292390805"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a85ee6401a47ae3fc64ba506cacb3e7873823c65",
"target": {
"file": "drivers/cpufreq/cpufreq_governor.h"
},
"deprecated": false,
"id": "CVE-2022-49513-d4901ff7",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"97482840261710202828708080551948861133",
"267759966117310483009607805191040636925",
"100500616241165190150886579127864505112",
"179032359837774268834711821195292390805"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a85ee6401a47ae3fc64ba506cacb3e7873823c65",
"target": {
"function": "cpufreq_dbs_governor_init",
"file": "drivers/cpufreq/cpufreq_governor.c"
},
"deprecated": false,
"id": "CVE-2022-49513-e9debff3",
"signature_version": "v1",
"digest": {
"length": 1442.0,
"function_hash": "247604902300510276389057964352383385046"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1e32083f327184b6226ce320ef30085ce785ea4e",
"target": {
"file": "drivers/cpufreq/cpufreq_governor.c"
},
"deprecated": false,
"id": "CVE-2022-49513-ef37d3e3",
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"154174298802360304472583911781340568540",
"58974010362398033499281068323644935582",
"60420354471350014150720086729814102511",
"207270700593686482530265839725945751755",
"266549150513241696222801737885339244635",
"251590044858264526802883952857007718111",
"244572163843800201545292567196663860694",
"60034713997428596437332274742544774312",
"130462470823445068559242873828665814964",
"68304590887479902773437125723586512508",
"200019732397606776397194030930843615374",
"239927300807417866894619669993825920658",
"24013743639702157658340651822771011843",
"129511553131132172575742280441319536878",
"262832998498498803243717591275635800539",
"247208081227086449254026634750627059191",
"172037979715441734486235423647709747123",
"178273799220418069638413521257780781703",
"247211286320299839205363046107372509694"
]
},
"signature_type": "Line"
}
]