In the Linux kernel, the following vulnerability has been resolved:
net: openvswitch: fix leak of nested actions
While parsing user-provided actions, openvswitch module may dynamically allocate memory and store pointers in the internal copy of the actions. So this memory has to be freed while destroying the actions.
Currently there are only two such actions: ct() and set(). However, there are many actions that can hold nested lists of actions and ovsnlafreeflowactions() just jumps over them leaking the memory.
For example, removal of the flow with the following actions will lead to a leak of the memory allocated by nfcttmpl_alloc():
actions:clone(ct(commit),0)
Non-freed set() action may also leak the 'dst' structure for the tunnel info including device references.
Under certain conditions with a high rate of flow rotation that may cause significant memory leak problem (2MB per second in reporter's case). The problem is also hard to mitigate, because the user doesn't have direct control over the datapath flows generated by OVS.
Fix that by iterating over all the nested actions and freeing everything that needs to be freed recursively.
New build time assertion should protect us from this problem if new actions will be added in the future.
Unfortunately, openvswitch module doesn't use NLAFNESTED, so all attributes has to be explicitly checked. sample() and clone() actions are mixing extra attributes into the user-provided action list. That prevents some code generalization too.
{
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/49xxx/CVE-2022-49086.json",
"cna_assigner": "Linux"
}[
{
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3554c214b83ec9a839ed574263a34218f372990c",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-004b69da",
"digest": {
"length": 330.0,
"function_hash": "36458590576437804247395642032822398910"
},
"target": {
"file": "net/openvswitch/flow_netlink.c",
"function": "ovs_nla_free_flow_actions"
}
},
{
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1f30fb9166d4f15a1aa19449b9da871fe0ed4796",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-24a5b7c1",
"digest": {
"length": 330.0,
"function_hash": "36458590576437804247395642032822398910"
},
"target": {
"file": "net/openvswitch/flow_netlink.c",
"function": "ovs_nla_free_flow_actions"
}
},
{
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@53bce9d19b0a9d245b25cd050b81652ed974a509",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-2e6c87cc",
"digest": {
"length": 330.0,
"function_hash": "36458590576437804247395642032822398910"
},
"target": {
"file": "net/openvswitch/flow_netlink.c",
"function": "ovs_nla_free_flow_actions"
}
},
{
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7438dc55c0709819b813f4778aec2c48b782990b",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-4069d4e6",
"digest": {
"line_hashes": [
"66108740145042528445252036051202904216",
"258505524680684828806196604628250648223",
"102501877410173127777374640649355529724",
"215063206608314665781017317997767367870",
"193879843586241536383089374043630905658",
"87577251016045250509221370159653332501",
"177065922719694327764534647579584497731",
"52983245353493944913872626203543058147",
"88330810841669371579645487767506250984",
"230837246630230832035745616765475113719",
"307886300317932360943498023273647690459",
"29757302633996376790863962054639923690",
"51965421589667954729032208454536005267",
"101091253467355748326136584217032569045",
"261900592723396056819057663804326836338",
"164663889581545467656689773611865310166",
"142268098103971317916411454547651268657",
"110901241211731130219871439498581277144",
"268440593923744139587701738090900618643",
"228391489576947917798898258314283471769",
"233549205007835696153026423721219149443",
"113303410487286336196515699977194769924"
],
"threshold": 0.9
},
"target": {
"file": "net/openvswitch/flow_netlink.c"
}
},
{
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5ae05b5eb58773cfec307ff88aff4cfd843c4cff",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-45943694",
"digest": {
"line_hashes": [
"66108740145042528445252036051202904216",
"258505524680684828806196604628250648223",
"102501877410173127777374640649355529724",
"215063206608314665781017317997767367870",
"193879843586241536383089374043630905658",
"87577251016045250509221370159653332501",
"177065922719694327764534647579584497731",
"52983245353493944913872626203543058147",
"88330810841669371579645487767506250984",
"230837246630230832035745616765475113719",
"307886300317932360943498023273647690459",
"29757302633996376790863962054639923690",
"51965421589667954729032208454536005267",
"101091253467355748326136584217032569045",
"261900592723396056819057663804326836338",
"164663889581545467656689773611865310166",
"142268098103971317916411454547651268657",
"110901241211731130219871439498581277144",
"268440593923744139587701738090900618643",
"228391489576947917798898258314283471769",
"233549205007835696153026423721219149443",
"113303410487286336196515699977194769924"
],
"threshold": 0.9
},
"target": {
"file": "net/openvswitch/flow_netlink.c"
}
},
{
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3554c214b83ec9a839ed574263a34218f372990c",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-47584c5a",
"digest": {
"line_hashes": [
"66108740145042528445252036051202904216",
"258505524680684828806196604628250648223",
"102501877410173127777374640649355529724",
"215063206608314665781017317997767367870",
"193879843586241536383089374043630905658",
"87577251016045250509221370159653332501",
"177065922719694327764534647579584497731",
"52983245353493944913872626203543058147",
"88330810841669371579645487767506250984",
"230837246630230832035745616765475113719",
"307886300317932360943498023273647690459",
"29757302633996376790863962054639923690",
"51965421589667954729032208454536005267",
"101091253467355748326136584217032569045",
"261900592723396056819057663804326836338",
"164663889581545467656689773611865310166",
"142268098103971317916411454547651268657",
"110901241211731130219871439498581277144",
"268440593923744139587701738090900618643",
"228391489576947917798898258314283471769",
"233549205007835696153026423721219149443",
"113303410487286336196515699977194769924"
],
"threshold": 0.9
},
"target": {
"file": "net/openvswitch/flow_netlink.c"
}
},
{
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7438dc55c0709819b813f4778aec2c48b782990b",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-4e08d5a5",
"digest": {
"length": 330.0,
"function_hash": "36458590576437804247395642032822398910"
},
"target": {
"file": "net/openvswitch/flow_netlink.c",
"function": "ovs_nla_free_flow_actions"
}
},
{
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@837b96d8103938e35e7d92cd9db96af914ca4fff",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-542913b8",
"digest": {
"line_hashes": [
"66108740145042528445252036051202904216",
"258505524680684828806196604628250648223",
"102501877410173127777374640649355529724",
"215063206608314665781017317997767367870",
"193879843586241536383089374043630905658",
"87577251016045250509221370159653332501",
"177065922719694327764534647579584497731",
"52983245353493944913872626203543058147",
"88330810841669371579645487767506250984",
"230837246630230832035745616765475113719",
"307886300317932360943498023273647690459",
"29757302633996376790863962054639923690",
"51965421589667954729032208454536005267",
"101091253467355748326136584217032569045",
"261900592723396056819057663804326836338",
"164663889581545467656689773611865310166",
"142268098103971317916411454547651268657",
"110901241211731130219871439498581277144",
"268440593923744139587701738090900618643",
"228391489576947917798898258314283471769",
"233549205007835696153026423721219149443",
"113303410487286336196515699977194769924"
],
"threshold": 0.9
},
"target": {
"file": "net/openvswitch/flow_netlink.c"
}
},
{
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5ae05b5eb58773cfec307ff88aff4cfd843c4cff",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-63102899",
"digest": {
"length": 330.0,
"function_hash": "36458590576437804247395642032822398910"
},
"target": {
"file": "net/openvswitch/flow_netlink.c",
"function": "ovs_nla_free_flow_actions"
}
},
{
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ef6f9ce0a79aa23b10fc5f3b3cab3814a25aac40",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-6dcfd3b7",
"digest": {
"length": 330.0,
"function_hash": "36458590576437804247395642032822398910"
},
"target": {
"file": "net/openvswitch/flow_netlink.c",
"function": "ovs_nla_free_flow_actions"
}
},
{
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@53bce9d19b0a9d245b25cd050b81652ed974a509",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-8b31848d",
"digest": {
"line_hashes": [
"66108740145042528445252036051202904216",
"258505524680684828806196604628250648223",
"102501877410173127777374640649355529724",
"215063206608314665781017317997767367870",
"193879843586241536383089374043630905658",
"87577251016045250509221370159653332501",
"177065922719694327764534647579584497731",
"52983245353493944913872626203543058147",
"88330810841669371579645487767506250984",
"230837246630230832035745616765475113719",
"307886300317932360943498023273647690459",
"29757302633996376790863962054639923690",
"51965421589667954729032208454536005267",
"101091253467355748326136584217032569045",
"261900592723396056819057663804326836338",
"164663889581545467656689773611865310166",
"142268098103971317916411454547651268657",
"110901241211731130219871439498581277144",
"268440593923744139587701738090900618643",
"228391489576947917798898258314283471769",
"233549205007835696153026423721219149443",
"113303410487286336196515699977194769924"
],
"threshold": 0.9
},
"target": {
"file": "net/openvswitch/flow_netlink.c"
}
},
{
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ef6f9ce0a79aa23b10fc5f3b3cab3814a25aac40",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-929e827c",
"digest": {
"line_hashes": [
"66108740145042528445252036051202904216",
"258505524680684828806196604628250648223",
"102501877410173127777374640649355529724",
"215063206608314665781017317997767367870",
"193879843586241536383089374043630905658",
"87577251016045250509221370159653332501",
"177065922719694327764534647579584497731",
"52983245353493944913872626203543058147",
"88330810841669371579645487767506250984",
"230837246630230832035745616765475113719",
"307886300317932360943498023273647690459",
"29757302633996376790863962054639923690",
"51965421589667954729032208454536005267",
"101091253467355748326136584217032569045",
"261900592723396056819057663804326836338",
"164663889581545467656689773611865310166",
"142268098103971317916411454547651268657",
"110901241211731130219871439498581277144",
"268440593923744139587701738090900618643",
"228391489576947917798898258314283471769",
"233549205007835696153026423721219149443",
"113303410487286336196515699977194769924"
],
"threshold": 0.9
},
"target": {
"file": "net/openvswitch/flow_netlink.c"
}
},
{
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@837b96d8103938e35e7d92cd9db96af914ca4fff",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-9edf17cf",
"digest": {
"length": 330.0,
"function_hash": "36458590576437804247395642032822398910"
},
"target": {
"file": "net/openvswitch/flow_netlink.c",
"function": "ovs_nla_free_flow_actions"
}
},
{
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1f30fb9166d4f15a1aa19449b9da871fe0ed4796",
"signature_version": "v1",
"deprecated": false,
"id": "CVE-2022-49086-d264d9a0",
"digest": {
"line_hashes": [
"66108740145042528445252036051202904216",
"258505524680684828806196604628250648223",
"102501877410173127777374640649355529724",
"215063206608314665781017317997767367870",
"193879843586241536383089374043630905658",
"87577251016045250509221370159653332501",
"177065922719694327764534647579584497731",
"52983245353493944913872626203543058147",
"88330810841669371579645487767506250984",
"230837246630230832035745616765475113719",
"307886300317932360943498023273647690459",
"29757302633996376790863962054639923690",
"51965421589667954729032208454536005267",
"101091253467355748326136584217032569045",
"261900592723396056819057663804326836338",
"164663889581545467656689773611865310166",
"142268098103971317916411454547651268657",
"110901241211731130219871439498581277144",
"268440593923744139587701738090900618643",
"228391489576947917798898258314283471769",
"233549205007835696153026423721219149443",
"113303410487286336196515699977194769924"
],
"threshold": 0.9
},
"target": {
"file": "net/openvswitch/flow_netlink.c"
}
}
]