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 8D67B22611 for ; Thu, 22 Aug 2024 03:33:45 +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=1724297625; cv=none; b=BCB5zEt4rN/lXURBwshuRsETGcEqD3hvGCFBAt5y92ZlUXcdXdsXUmvjauxyZIhMCi+iIV6FfI0OWijsCU8YSbZ8wPQ7+Ipgpu3rfFGo37F2ZZdNEMAuUWq61g/bgBfjPCBYl1tKKUogcfWxKBgG6JamD012/xw39oQsgYzO6EE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724297625; c=relaxed/simple; bh=wvup6uoj/t73eWp7//p2MgRUuKcBpAD3SWlGn+zeZds=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FOhWAtUnt4uMRqsDS8dn6OM7KW0fBCLDoLDZZwXm1GnvZlLigfQC26BVFa25fPGvGdbdq45ZTozPFNfrj3C3bxQxentlPvltDquBoQJ8V6+VvjhZ7MXiliXQt1IVDaNFVNlH1V7f9kBBGYc9/XzLCK/dZEvhWU/89u/ZoyjYfdA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vwAg0C6z; 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="vwAg0C6z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E9C3C4AF0C; Thu, 22 Aug 2024 03:33:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724297625; bh=wvup6uoj/t73eWp7//p2MgRUuKcBpAD3SWlGn+zeZds=; h=From:To:Cc:Subject:Date:Reply-to:From; b=vwAg0C6zE7YGlm5CQ3isn/8xQuIXDR1KGs95oqUw5SV+XSDKjvEtzTg/BB9LQYVFw r7TQi2xlts9mK4jL2JDwdVN+AgfYqsudfwRzU1qstfh5d8gypr0VXNgJ9VuygLWkD/ 8alnyBZDUSL8xyKJZ7ZLG8N8pVCjPdaciPJReS24= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48910: net: ipv6: ensure we call ipv6_mc_down() at most once Date: Thu, 22 Aug 2024 11:31:11 +0800 Message-ID: <2024082214-CVE-2022-48910-a749@gregkh> X-Mailer: git-send-email 2.46.0 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=4463; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=wvup6uoj/t73eWp7//p2MgRUuKcBpAD3SWlGn+zeZds=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnHNjJ96pF9vrhhHoswx0KZizEeulc0JT6tdvfqDpHgb 9vyzSO/I5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACbCr8owv3jhavc/d/R0n69U PTTnmz/n8+wHRxnm2RpOfW61YG30rtsXq1JamaPLbqiuBwA= 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: ipv6: ensure we call ipv6_mc_down() at most once There are two reasons for addrconf_notify() to be called with NETDEV_DOWN: either the network device is actually going down, or IPv6 was disabled on the interface. If either of them stays down while the other is toggled, we repeatedly call the code for NETDEV_DOWN, including ipv6_mc_down(), while never calling the corresponding ipv6_mc_up() in between. This will cause a new entry in idev->mc_tomb to be allocated for each multicast group the interface is subscribed to, which in turn leaks one struct ifmcaddr6 per nontrivial multicast group the interface is subscribed to. The following reproducer will leak at least $n objects: ip addr add ff2e::4242/32 dev eth0 autojoin sysctl -w net.ipv6.conf.eth0.disable_ipv6=1 for i in $(seq 1 $n); do ip link set up eth0; ip link set down eth0 done Joining groups with IPV6_ADD_MEMBERSHIP (unprivileged) or setting the sysctl net.ipv6.conf.eth0.forwarding to 1 (=> subscribing to ff02::2) can also be used to create a nontrivial idev->mc_list, which will the leak objects with the right up-down-sequence. Based on both sources for NETDEV_DOWN events the interface IPv6 state should be considered: - not ready if the network interface is not ready OR IPv6 is disabled for it - ready if the network interface is ready AND IPv6 is enabled for it The functions ipv6_mc_up() and ipv6_down() should only be run when this state changes. Implement this by remembering when the IPv6 state is ready, and only run ipv6_mc_down() if it actually changed from ready to not ready. The other direction (not ready -> ready) already works correctly, as: - the interface notification triggered codepath for NETDEV_UP / NETDEV_CHANGE returns early if ipv6 is disabled, and - the disable_ipv6=0 triggered codepath skips fully initializing the interface as long as addrconf_link_ready(dev) returns false - calling ipv6_mc_up() repeatedly does not leak anything The Linux kernel CVE team has assigned CVE-2022-48910 to this issue. Affected and fixed versions =========================== Issue introduced in 3.18 with commit 3ce62a84d53c and fixed in 4.9.313 with commit 9a8736b2da28 Issue introduced in 3.18 with commit 3ce62a84d53c and fixed in 4.14.278 with commit c71bf3229f9e Issue introduced in 3.18 with commit 3ce62a84d53c and fixed in 5.4.193 with commit 9588ac2eddc2 Issue introduced in 3.18 with commit 3ce62a84d53c and fixed in 5.10.104 with commit f4c63b24dea9 Issue introduced in 3.18 with commit 3ce62a84d53c and fixed in 5.15.27 with commit b11781515208 Issue introduced in 3.18 with commit 3ce62a84d53c and fixed in 5.16.13 with commit 72124e65a70b Issue introduced in 3.18 with commit 3ce62a84d53c and fixed in 5.17 with commit 9995b408f17f 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-48910 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/ipv6/addrconf.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/9a8736b2da28b24f01707f592ff059b9f90a058c https://git.kernel.org/stable/c/c71bf3229f9e9dd60ba02f5a5be02066edf57012 https://git.kernel.org/stable/c/9588ac2eddc2f223ebcebf6e9f5caed84d32922b https://git.kernel.org/stable/c/f4c63b24dea9cc2043ff845dcca9aaf8109ea38a https://git.kernel.org/stable/c/b11781515208dd31fbcd0b664078dce5dc44523f https://git.kernel.org/stable/c/72124e65a70b84e6303a5cd21b0ac1f27d7d61a4 https://git.kernel.org/stable/c/9995b408f17ff8c7f11bc725c8aa225ba3a63b1c