In the Linux kernel, the following vulnerability has been resolved:
net: tun: Fix memory leaks of napigetfrags
kmemleak reports after running test_progs:
unreferenced object 0xffff8881b1672dc0 (size 232): comm "testprogs", pid 394388, jiffies 4354712116 (age 841.975s) hex dump (first 32 bytes): e0 84 d7 a8 81 88 ff ff 80 2c 67 b1 81 88 ff ff .........,g..... 00 40 c5 9b 81 88 ff ff 00 00 00 00 00 00 00 00 .@.............. backtrace: [<00000000c8f01748>] napiskbcacheget+0xd4/0x150 [<0000000041c7fc09>] _napibuildskb+0x15/0x50 [<00000000431c7079>] _napiallocskb+0x26e/0x540 [<000000003ecfa30e>] napigetfrags+0x59/0x140 [<0000000099b2199e>] tungetuser+0x183d/0x3bb0 [tun] [<000000008a5adef0>] tunchrwriteiter+0xc0/0x1b1 [tun] [<0000000049993ff4>] doiterreadvwritev+0x19f/0x320 [<000000008f338ea2>] doiterwrite+0x135/0x630 [<000000008a3377a4>] vfswritev+0x12e/0x440 [<00000000a6b5639a>] dowritev+0x104/0x280 [<00000000ccf065d8>] dosyscall64+0x3b/0x90 [<00000000d776e329>] entrySYSCALL64afterhwframe+0x63/0xcd
The issue occurs in the following scenarios: tungetuser() napigrofrags() napifragsfinish() case GRONORMAL: gronormalone() listaddtail(&skb->list, &napi->rxlist); <-- While napi->rxcount < READONCE(gronormalbatch), <-- gronormallist() is not called, napi->rxlist is not empty <-- not ask to complete the gro work, will cause memory leaks in <-- following tunnapidel() ... tunnapidel() netifnapidel() _netifnapidel() <-- &napi->rx_list is not empty, which caused memory leaks
To fix, add napicomplete() after napigro_frags().
[
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a4f73f6adc53fd7a3f9771cbc89a03ef39b0b755",
"id": "CVE-2022-49871-0fe133d1",
"deprecated": false,
"target": {
"function": "tun_get_user",
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"length": 5564.0,
"function_hash": "184977925014821103913777242458231001550"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8b12a020b20a78f62bedc50f26db3bf4fadf8cb9",
"id": "CVE-2022-49871-3601cb8a",
"deprecated": false,
"target": {
"function": "tun_get_user",
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"length": 5339.0,
"function_hash": "299558487418609618751990190657066910383"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8b12a020b20a78f62bedc50f26db3bf4fadf8cb9",
"id": "CVE-2022-49871-3ed8fc9c",
"deprecated": false,
"target": {
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"289791689221973417907322931276334550472",
"297559539608770002430857098324813153204",
"260472350024333092772536259927166424962",
"107040130185971492426243293745446895838"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d7569302a7a52a9305d2fb054df908ff985553bb",
"id": "CVE-2022-49871-4438dbd0",
"deprecated": false,
"target": {
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"289791689221973417907322931276334550472",
"297559539608770002430857098324813153204",
"260472350024333092772536259927166424962",
"107040130185971492426243293745446895838"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@223ef6a94e52331a6a7ef31e59921e0e82d2d40a",
"id": "CVE-2022-49871-486cb42a",
"deprecated": false,
"target": {
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"289791689221973417907322931276334550472",
"297559539608770002430857098324813153204",
"260472350024333092772536259927166424962",
"107040130185971492426243293745446895838"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@223ef6a94e52331a6a7ef31e59921e0e82d2d40a",
"id": "CVE-2022-49871-5184894e",
"deprecated": false,
"target": {
"function": "tun_get_user",
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"length": 5511.0,
"function_hash": "265543823230145834265972894097670549916"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1118b2049d77ca0b505775fc1a8d1909cf19a7ec",
"id": "CVE-2022-49871-a9efe8a4",
"deprecated": false,
"target": {
"function": "tun_get_user",
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"length": 5339.0,
"function_hash": "299558487418609618751990190657066910383"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d7569302a7a52a9305d2fb054df908ff985553bb",
"id": "CVE-2022-49871-b608ecb7",
"deprecated": false,
"target": {
"function": "tun_get_user",
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"length": 5293.0,
"function_hash": "233554574797875928263665554547747212236"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3401f964028ac941425b9b2c8ff8a022539ef44a",
"id": "CVE-2022-49871-c8e29f46",
"deprecated": false,
"target": {
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"289791689221973417907322931276334550472",
"297559539608770002430857098324813153204",
"260472350024333092772536259927166424962",
"107040130185971492426243293745446895838"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1118b2049d77ca0b505775fc1a8d1909cf19a7ec",
"id": "CVE-2022-49871-d0171e25",
"deprecated": false,
"target": {
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"289791689221973417907322931276334550472",
"297559539608770002430857098324813153204",
"260472350024333092772536259927166424962",
"107040130185971492426243293745446895838"
]
},
"signature_type": "Line"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3401f964028ac941425b9b2c8ff8a022539ef44a",
"id": "CVE-2022-49871-d9026db3",
"deprecated": false,
"target": {
"function": "tun_get_user",
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"length": 5590.0,
"function_hash": "36990524545619085028164462159942707401"
},
"signature_type": "Function"
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a4f73f6adc53fd7a3f9771cbc89a03ef39b0b755",
"id": "CVE-2022-49871-e2a82097",
"deprecated": false,
"target": {
"file": "drivers/net/tun.c"
},
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"289791689221973417907322931276334550472",
"297559539608770002430857098324813153204",
"260472350024333092772536259927166424962",
"107040130185971492426243293745446895838"
]
},
"signature_type": "Line"
}
]