Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 992911AAA2F for ; Wed, 26 Feb 2025 01:58:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740535083; cv=none; b=PG4ImGG+uAuVhw2kISDKhoXlStG5ZRe4irAWXDB2Kw2h3S3kji3EQDJBF4vL8MJVng2VU7vdfcW+r/Xjz+v0enM3DMZxtr2tQk+PXlFyysfh91zRhwxGmteEUV7obzG8mGkq0MdtHERAOClogABHxOHzxz2VQOJGSBqnz3LcIf8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740535083; c=relaxed/simple; bh=njJv/W+wEIm52QDLS0IRedkvBp/QS1/0TtMWiLRtmNI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=moPUM7wBzUXSNihw62/qti1qbd6fTYIx2pL7mu6X3T+ejO8ob3rJNpc6CUBUh61cFNqL7FRl6TPGcbzqlDzTQvGwPSlN69PavJ90QL1fnwd+0PrcXeJ/6jx0NBil7o3Bshk0HIDZbqRbeDW765VaydaVQUU4tJphcEf8+owosWg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TDWDJfcK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TDWDJfcK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69BE9C4CEE6; Wed, 26 Feb 2025 01:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740535083; bh=njJv/W+wEIm52QDLS0IRedkvBp/QS1/0TtMWiLRtmNI=; h=From:To:Cc:Subject:Date:Reply-to:From; b=TDWDJfcKqwGFu4T5D20eK75ULk7NuEPfQxfXhqsurk6hyuJQ56X0MiMZsskYuvEMS a5sTQT770xdInvWbC62W3a4m0nkEImdrbtYSN2EZyM7ssk7SbVe2WyC5LQwchZOR3y ElTLSKVZUaD0llTVvHX5DTdMfqQWsDrw+3WO/xYY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49086: net: openvswitch: fix leak of nested actions Date: Wed, 26 Feb 2025 02:54:51 +0100 Message-ID: <2025022657-CVE-2022-49086-a289@gregkh> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4336; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=njJv/W+wEIm52QDLS0IRedkvBp/QS1/0TtMWiLRtmNI=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7SsyCPjtGpPBNke28W/y40rJ4obfH4YI+j9SFmvxVS wNenJvREcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABPZ28uw4HRR/Ws9i62Lret0 fqxs4l+cG73ajGHB0sqgD3d8Kn0V3j5rMJTud9oR2jkXAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== 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 ovs_nla_free_flow_actions() 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 nf_ct_tmpl_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 NLA_F_NESTED, 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. The Linux kernel CVE team has assigned CVE-2022-49086 to this issue. Affected and fixed versions =========================== Issue introduced in 4.3 with commit 34ae932a40369be6bd6ea97d66b6686361b4370d and fixed in 4.19.249 with commit 7438dc55c0709819b813f4778aec2c48b782990b Issue introduced in 4.3 with commit 34ae932a40369be6bd6ea97d66b6686361b4370d and fixed in 5.4.200 with commit ef6f9ce0a79aa23b10fc5f3b3cab3814a25aac40 Issue introduced in 4.3 with commit 34ae932a40369be6bd6ea97d66b6686361b4370d and fixed in 5.10.111 with commit 5ae05b5eb58773cfec307ff88aff4cfd843c4cff Issue introduced in 4.3 with commit 34ae932a40369be6bd6ea97d66b6686361b4370d and fixed in 5.15.34 with commit 837b96d8103938e35e7d92cd9db96af914ca4fff Issue introduced in 4.3 with commit 34ae932a40369be6bd6ea97d66b6686361b4370d and fixed in 5.16.20 with commit 3554c214b83ec9a839ed574263a34218f372990c Issue introduced in 4.3 with commit 34ae932a40369be6bd6ea97d66b6686361b4370d and fixed in 5.17.3 with commit 53bce9d19b0a9d245b25cd050b81652ed974a509 Issue introduced in 4.3 with commit 34ae932a40369be6bd6ea97d66b6686361b4370d and fixed in 5.18 with commit 1f30fb9166d4f15a1aa19449b9da871fe0ed4796 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2022-49086 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: net/openvswitch/flow_netlink.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/7438dc55c0709819b813f4778aec2c48b782990b https://git.kernel.org/stable/c/ef6f9ce0a79aa23b10fc5f3b3cab3814a25aac40 https://git.kernel.org/stable/c/5ae05b5eb58773cfec307ff88aff4cfd843c4cff https://git.kernel.org/stable/c/837b96d8103938e35e7d92cd9db96af914ca4fff https://git.kernel.org/stable/c/3554c214b83ec9a839ed574263a34218f372990c https://git.kernel.org/stable/c/53bce9d19b0a9d245b25cd050b81652ed974a509 https://git.kernel.org/stable/c/1f30fb9166d4f15a1aa19449b9da871fe0ed4796