In the Linux kernel, the following vulnerability has been resolved:
net/tunnel: wait until all skuserdata reader finish before releasing the sock
There is a race condition in vxlan that when deleting a vxlan device during receiving packets, there is a possibility that the sock is released after getting vxlansock vs from skuserdata. Then in later vxlanecndecapsulate(), vxlangetskfamily() we will got NULL pointer dereference. e.g.
#0 [ffffa25ec6978a38] machinekexec at ffffffff8c669757 #1 [ffffa25ec6978a90] _crashkexec at ffffffff8c7c0a4d #2 [ffffa25ec6978b58] crashkexec at ffffffff8c7c1c48 #3 [ffffa25ec6978b60] oopsend at ffffffff8c627f2b #4 [ffffa25ec6978b80] pagefaultoops at ffffffff8c678fcb #5 [ffffa25ec6978bd8] excpagefault at ffffffff8d109542 #6 [ffffa25ec6978c00] asmexcpagefault at ffffffff8d200b62 [exception RIP: vxlanecndecapsulate+0x3b] RIP: ffffffffc1014e7b RSP: ffffa25ec6978cb0 RFLAGS: 00010246 RAX: 0000000000000008 RBX: ffff8aa000888000 RCX: 0000000000000000 RDX: 000000000000000e RSI: ffff8a9fc7ab803e RDI: ffff8a9fd1168700 RBP: ffff8a9fc7ab803e R8: 0000000000700000 R9: 00000000000010ae R10: ffff8a9fcb748980 R11: 0000000000000000 R12: ffff8a9fd1168700 R13: ffff8aa000888000 R14: 00000000002a0000 R15: 00000000000010ae ORIGRAX: ffffffffffffffff CS: 0010 SS: 0018 #7 [ffffa25ec6978ce8] vxlanrcv at ffffffffc10189cd [vxlan] #8 [ffffa25ec6978d90] udpqueuercvoneskb at ffffffff8cfb6507 #9 [ffffa25ec6978dc0] udpunicastrcvskb at ffffffff8cfb6e45 #10 [ffffa25ec6978dc8] _udp4librcv at ffffffff8cfb8807 #11 [ffffa25ec6978e20] ipprotocoldeliverrcu at ffffffff8cf76951 #12 [ffffa25ec6978e48] iplocaldeliver at ffffffff8cf76bde #13 [ffffa25ec6978ea0] _netifreceiveskbonecore at ffffffff8cecde9b #14 [ffffa25ec6978ec8] processbacklog at ffffffff8cece139 #15 [ffffa25ec6978f00] _napipoll at ffffffff8ceced1a #16 [ffffa25ec6978f28] netrxaction at ffffffff8cecf1f3 #17 [ffffa25ec6978fa0] _softirqentrytextstart at ffffffff8d4000ca #18 [ffffa25ec6978ff0] do_softirq at ffffffff8c6fbdc3
Reproducer: https://github.com/Mellanox/ovs-tests/blob/master/test-ovs-vxlan-remove-tunnel-during-traffic.sh
Fix this by waiting for all skuserdata reader to finish before releasing the sock.
[
{
"signature_type": "Function",
"digest": {
"function_hash": "305349738700835054168218896524604410821",
"length": 124.0
},
"target": {
"file": "net/ipv4/udp_tunnel.c",
"function": "udp_tunnel_sock_release"
},
"signature_version": "v1",
"id": "CVE-2022-50405-0aacfc55",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e8316584b0a6c61c9c407631040c22712b26e38c"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "305349738700835054168218896524604410821",
"length": 124.0
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c",
"function": "udp_tunnel_sock_release"
},
"signature_version": "v1",
"id": "CVE-2022-50405-1c17f998",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3cf7203ca620682165706f70a1b12b5194607dce"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"273199578745835973410342836378134218438",
"25740939440196426364645351700920636967",
"222649309318569049832891946711323206646",
"244034108655004499398488876784283867146"
]
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c"
},
"signature_version": "v1",
"id": "CVE-2022-50405-1ec52722",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@91f09a776ae335ca836ed864b8f2a9461882a280"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "305349738700835054168218896524604410821",
"length": 124.0
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c",
"function": "udp_tunnel_sock_release"
},
"signature_version": "v1",
"id": "CVE-2022-50405-22128768",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b38aa7465411795e9e744b8d94633910497fec2a"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "305349738700835054168218896524604410821",
"length": 124.0
},
"target": {
"file": "net/ipv4/udp_tunnel.c",
"function": "udp_tunnel_sock_release"
},
"signature_version": "v1",
"id": "CVE-2022-50405-3c926ab5",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@303000c793f705d07b551eb7c1c27001c5b33c8d"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"273199578745835973410342836378134218438",
"25740939440196426364645351700920636967",
"222649309318569049832891946711323206646",
"244034108655004499398488876784283867146"
]
},
"target": {
"file": "net/ipv4/udp_tunnel.c"
},
"signature_version": "v1",
"id": "CVE-2022-50405-3d46c47b",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@be34e79e0ae6adbf6e7e75ddaee9ad84795ab933"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"273199578745835973410342836378134218438",
"25740939440196426364645351700920636967",
"222649309318569049832891946711323206646",
"244034108655004499398488876784283867146"
]
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c"
},
"signature_version": "v1",
"id": "CVE-2022-50405-42f350d3",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9a6544343bba7da929d6d4a2dc44ec0f15970081"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "305349738700835054168218896524604410821",
"length": 124.0
},
"target": {
"file": "net/ipv4/udp_tunnel.c",
"function": "udp_tunnel_sock_release"
},
"signature_version": "v1",
"id": "CVE-2022-50405-5fe50856",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@84e566d157cc22ad2da8bdd970495855fbf13d92"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"273199578745835973410342836378134218438",
"25740939440196426364645351700920636967",
"222649309318569049832891946711323206646",
"244034108655004499398488876784283867146"
]
},
"target": {
"file": "net/ipv4/udp_tunnel.c"
},
"signature_version": "v1",
"id": "CVE-2022-50405-76a4cb06",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@303000c793f705d07b551eb7c1c27001c5b33c8d"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"273199578745835973410342836378134218438",
"25740939440196426364645351700920636967",
"222649309318569049832891946711323206646",
"244034108655004499398488876784283867146"
]
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c"
},
"signature_version": "v1",
"id": "CVE-2022-50405-8d2fd532",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@b38aa7465411795e9e744b8d94633910497fec2a"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "305349738700835054168218896524604410821",
"length": 124.0
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c",
"function": "udp_tunnel_sock_release"
},
"signature_version": "v1",
"id": "CVE-2022-50405-a3ba0a06",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9a6544343bba7da929d6d4a2dc44ec0f15970081"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "305349738700835054168218896524604410821",
"length": 124.0
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c",
"function": "udp_tunnel_sock_release"
},
"signature_version": "v1",
"id": "CVE-2022-50405-aba256c7",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@91f09a776ae335ca836ed864b8f2a9461882a280"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"273199578745835973410342836378134218438",
"25740939440196426364645351700920636967",
"222649309318569049832891946711323206646",
"244034108655004499398488876784283867146"
]
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c"
},
"signature_version": "v1",
"id": "CVE-2022-50405-acd45d50",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3cf7203ca620682165706f70a1b12b5194607dce"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "305349738700835054168218896524604410821",
"length": 124.0
},
"target": {
"file": "net/ipv4/udp_tunnel.c",
"function": "udp_tunnel_sock_release"
},
"signature_version": "v1",
"id": "CVE-2022-50405-b861dee7",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@be34e79e0ae6adbf6e7e75ddaee9ad84795ab933"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"273199578745835973410342836378134218438",
"25740939440196426364645351700920636967",
"222649309318569049832891946711323206646",
"244034108655004499398488876784283867146"
]
},
"target": {
"file": "net/ipv4/udp_tunnel.c"
},
"signature_version": "v1",
"id": "CVE-2022-50405-ed0af9ec",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@84e566d157cc22ad2da8bdd970495855fbf13d92"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"273199578745835973410342836378134218438",
"25740939440196426364645351700920636967",
"222649309318569049832891946711323206646",
"244034108655004499398488876784283867146"
]
},
"target": {
"file": "net/ipv4/udp_tunnel.c"
},
"signature_version": "v1",
"id": "CVE-2022-50405-f921fe37",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e8316584b0a6c61c9c407631040c22712b26e38c"
},
{
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"273199578745835973410342836378134218438",
"25740939440196426364645351700920636967",
"222649309318569049832891946711323206646",
"244034108655004499398488876784283867146"
]
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c"
},
"signature_version": "v1",
"id": "CVE-2022-50405-fa2ad089",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@588d0b8462f5ffed3e677e65639825b2678117ab"
},
{
"signature_type": "Function",
"digest": {
"function_hash": "305349738700835054168218896524604410821",
"length": 124.0
},
"target": {
"file": "net/ipv4/udp_tunnel_core.c",
"function": "udp_tunnel_sock_release"
},
"signature_version": "v1",
"id": "CVE-2022-50405-fb61f7aa",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@588d0b8462f5ffed3e677e65639825b2678117ab"
}
]