In the Linux kernel, the following vulnerability has been resolved:
net/mlx5e: Fix netif state handling
mlx5esuspend cleans resources only if netifdevicepresent() returns true. However, mlx5eresume changes the state of netif, via mlx5enicenable, only if regstate == NETREGREGISTERED. In the below case, the above leads to NULL-ptr Oops[1] and memory leaks:
mlx5eprobe _mlx5eresume mlx5eattachnetdev mlx5enicenable <-- netdev not reg, not calling netifdeviceattach() registernetdev <-- failed for some reason. ERRORFLOW: mlx5esuspend <-- netifdevicepresent return false, resources aren't freed :(
Hence, clean resources in this case as well.
[1] BUG: kernel NULL pointer dereference, address: 0000000000000000 PGD 0 P4D 0 Oops: 0010 [#1] SMP CPU: 2 PID: 9345 Comm: test-ovs-ct-gen Not tainted 6.5.0forupstreammindebug202309051601 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:0x0 Code: Unable to access opcode bytes at0xffffffffffffffd6. RSP: 0018:ffff888178aaf758 EFLAGS: 00010246 Call Trace: <TASK> ? _die+0x20/0x60 ? pagefaultoops+0x14c/0x3c0 ? excpagefault+0x75/0x140 ? asmexcpagefault+0x22/0x30 notifiercallchain+0x35/0xb0 blockingnotifiercallchain+0x3d/0x60 mlx5blockingnotifiercallchain+0x22/0x30 [mlx5core] mlx5coreuplinknetdeveventreplay+0x3e/0x60 [mlx5core] mlx5mdevnetdevtrack+0x53/0x60 [mlx5ib] mlx5ibroceinit+0xc3/0x340 [mlx5ib] _mlx5ibadd+0x34/0xd0 [mlx5ib] mlx5rprobe+0xe1/0x210 [mlx5ib] ? auxiliarymatchid+0x6a/0x90 auxiliarybusprobe+0x38/0x80 ? driversysfsadd+0x51/0x80 reallyprobe+0xc9/0x3e0 ? driverprobedevice+0x90/0x90 _driverprobedevice+0x80/0x160 driverprobedevice+0x1e/0x90 _deviceattachdriver+0x7d/0x100 busforeachdrv+0x80/0xd0 _deviceattach+0xbc/0x1f0 busprobedevice+0x86/0xa0 deviceadd+0x637/0x840 _auxiliarydeviceadd+0x3b/0xa0 addadev+0xc9/0x140 [mlx5core] mlx5rescandriverslocked+0x22a/0x310 [mlx5core] mlx5registerdevice+0x53/0xa0 [mlx5core] mlx5initonedevllocked+0x5c4/0x9c0 [mlx5core] mlx5initone+0x3b/0x60 [mlx5core] probeone+0x44c/0x730 [mlx5core] localpciprobe+0x3e/0x90 pcideviceprobe+0xbf/0x210 ? kernfscreatelink+0x5d/0xa0 ? sysfsdocreatelinksd+0x60/0xc0 reallyprobe+0xc9/0x3e0 ? driverprobedevice+0x90/0x90 _driverprobedevice+0x80/0x160 driverprobedevice+0x1e/0x90 _deviceattachdriver+0x7d/0x100 busforeachdrv+0x80/0xd0 _deviceattach+0xbc/0x1f0 pcibusadddevice+0x54/0x80 pciiovaddvirtfn+0x2e6/0x320 sriovenable+0x208/0x420 mlx5coresriovconfigure+0x9e/0x200 [mlx5core] sriovnumvfsstore+0xae/0x1a0 kernfsfopwriteiter+0x10c/0x1a0 vfswrite+0x291/0x3c0 ksyswrite+0x5f/0xe0 dosyscall64+0x3d/0x90 entrySYSCALL64afterhwframe+0x46/0xb0 CR2: 0000000000000000 ---[ end trace 0000000000000000 ]---
{ "vanir_signatures": [ { "signature_version": "v1", "target": { "function": "_mlx5e_probe", "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3d5918477f94e4c2f064567875c475468e264644", "deprecated": false, "digest": { "length": 1515.0, "function_hash": "17517874124144954040064951143161972599" }, "id": "CVE-2024-38608-1961a40e" }, { "signature_version": "v1", "target": { "function": "mlx5e_suspend", "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f7e6cfb864a53af71c5cc904f1cc22215d68f5c6", "deprecated": false, "digest": { "length": 308.0, "function_hash": "218965753159950206237919568100874525889" }, "id": "CVE-2024-38608-260657c9" }, { "signature_version": "v1", "target": { "function": "mlx5e_suspend", "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3d5918477f94e4c2f064567875c475468e264644", "deprecated": false, "digest": { "length": 308.0, "function_hash": "218965753159950206237919568100874525889" }, "id": "CVE-2024-38608-3b05d3a3" }, { "signature_version": "v1", "target": { "function": "_mlx5e_probe", "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f7e6cfb864a53af71c5cc904f1cc22215d68f5c6", "deprecated": false, "digest": { "length": 1515.0, "function_hash": "17517874124144954040064951143161972599" }, "id": "CVE-2024-38608-468286a5" }, { "signature_version": "v1", "target": { "function": "_mlx5e_remove", "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f7e6cfb864a53af71c5cc904f1cc22215d68f5c6", "deprecated": false, "digest": { "length": 399.0, "function_hash": "218761061198025019941397862960896230087" }, "id": "CVE-2024-38608-9251f39d" }, { "signature_version": "v1", "target": { "function": "_mlx5e_suspend", "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f7e6cfb864a53af71c5cc904f1cc22215d68f5c6", "deprecated": false, "digest": { "length": 443.0, "function_hash": "24455834876651050693732037804558898019" }, "id": "CVE-2024-38608-c885c133" }, { "signature_version": "v1", "target": { "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Line", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3d5918477f94e4c2f064567875c475468e264644", "deprecated": false, "digest": { "line_hashes": [ "248335789688528012017488933666321057017", "228838024844354573896818709506547019891", "224548126179678621815105274139566176481", "203653814817505494864141442267787206692", "176072885104216122907670849644071436428", "313529583291482183162903140931823041747", "5125654337207185792763934911377217706", "166660119214435144997620235703179500812", "160909158782050811925089949086737780127", "102422963063415030676339460517397246958", "171622578551726140845358964512669005766", "211413843115849357327332203871218342362", "196648663520916446139527688471320789930", "187389382534095034022767464429820646210", "161906612761945550805375879668484644979", "104394062054492532328560361484171404846", "91243418462729224694452783481956215023", "30942405332043460645509856056946460679", "93551866756150744354977611553368903323", "189976945881441307314915123008321639065" ], "threshold": 0.9 }, "id": "CVE-2024-38608-cb1c5ac8" }, { "signature_version": "v1", "target": { "function": "_mlx5e_suspend", "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3d5918477f94e4c2f064567875c475468e264644", "deprecated": false, "digest": { "length": 443.0, "function_hash": "24455834876651050693732037804558898019" }, "id": "CVE-2024-38608-cf3973e0" }, { "signature_version": "v1", "target": { "function": "_mlx5e_remove", "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Function", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3d5918477f94e4c2f064567875c475468e264644", "deprecated": false, "digest": { "length": 399.0, "function_hash": "218761061198025019941397862960896230087" }, "id": "CVE-2024-38608-e8ec09ac" }, { "signature_version": "v1", "target": { "file": "drivers/net/ethernet/mellanox/mlx5/core/en_main.c" }, "signature_type": "Line", "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f7e6cfb864a53af71c5cc904f1cc22215d68f5c6", "deprecated": false, "digest": { "line_hashes": [ "248335789688528012017488933666321057017", "228838024844354573896818709506547019891", "224548126179678621815105274139566176481", "203653814817505494864141442267787206692", "176072885104216122907670849644071436428", "313529583291482183162903140931823041747", "5125654337207185792763934911377217706", "166660119214435144997620235703179500812", "160909158782050811925089949086737780127", "102422963063415030676339460517397246958", "171622578551726140845358964512669005766", "211413843115849357327332203871218342362", "196648663520916446139527688471320789930", "187389382534095034022767464429820646210", "161906612761945550805375879668484644979", "104394062054492532328560361484171404846", "91243418462729224694452783481956215023", "30942405332043460645509856056946460679", "93551866756150744354977611553368903323", "189976945881441307314915123008321639065" ], "threshold": 0.9 }, "id": "CVE-2024-38608-f5c87652" } ] }