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 B2AE8155336 for ; Tue, 25 Jun 2024 14:23:29 +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=1719325409; cv=none; b=uE9aR/0TkJ2XRbPp+pWa5SXb5uqMW4lJNieuN42E0yWvtmpHnX1NH63RC0yudWMYb4xY28Ymr5i0NmiOl/l1xW6+u/9QyPu8mA3Eo4T7nfHCsxlM1wUkLtp1tvJYuszmDLy9fd1hwGVHetD/IXkl9YlrvP89R0w32I5wbLhsfLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719325409; c=relaxed/simple; bh=bwgq270ru5s3LYqMKUoN2StE6WnCGxf0M8dNGz5k9uk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=m6Pi7d725rik3tWc2AVlHrmT4mqQafCnOZ6ogOUwO17wAB2N8fvwCWAXv4ErByTBtTLPhUQYOXnHPkNMkyPLID9hHrgZjP1E+ObyqZtWTowHRxgzi4PNeczuZS4EteXveqYJnoD95stAUI21IzZi0SS8n/CTB8t7exKJjbKqUXI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AmxoRlBn; 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="AmxoRlBn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E09A0C32781; Tue, 25 Jun 2024 14:23:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1719325409; bh=bwgq270ru5s3LYqMKUoN2StE6WnCGxf0M8dNGz5k9uk=; h=From:To:Cc:Subject:Date:Reply-to:From; b=AmxoRlBn2Hy430CKAg3vSvo+74lNT2iYbbK7d2QJF9TjxjP4bk6Qbw1QcSewmn51B hWPD2xo57tWEuIXb4vzJod6uQv+FNAyKj0JCuviapAgjj8Wuz+4+bo9HNngbkV73dg IWODAPZKrQ5t0Hfp9hVLLdWvB7FzIoQElg69Lrmo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-39296: bonding: fix oops during rmmod Date: Tue, 25 Jun 2024 16:22:55 +0200 Message-ID: <2024062549-CVE-2024-39296-3976@gregkh> X-Mailer: git-send-email 2.45.2 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=3286; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=bwgq270ru5s3LYqMKUoN2StE6WnCGxf0M8dNGz5k9uk=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlVl3aaXepf1McfaCQur+Mv8L/6c94aT6aL0jWsfjt7r CNnnf/TEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABNRZ2SYw3V9pZ+7wqS8g0z1 HfZLLj04dPG7PcM8g1X6KzZ41e6/pBBidEjl74FN+V6iAA== 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: bonding: fix oops during rmmod "rmmod bonding" causes an oops ever since commit cc317ea3d927 ("bonding: remove redundant NULL check in debugfs function"). Here are the relevant functions being called: bonding_exit() bond_destroy_debugfs() debugfs_remove_recursive(bonding_debug_root); bonding_debug_root = NULL; <--------- SET TO NULL HERE bond_netlink_fini() rtnl_link_unregister() __rtnl_link_unregister() unregister_netdevice_many_notify() bond_uninit() bond_debug_unregister() (commit removed check for bonding_debug_root == NULL) debugfs_remove() simple_recursive_removal() down_write() -> OOPS However, reverting the bad commit does not solve the problem completely because the original code contains a race that could cause the same oops, although it was much less likely to be triggered unintentionally: CPU1 rmmod bonding bonding_exit() bond_destroy_debugfs() debugfs_remove_recursive(bonding_debug_root); CPU2 echo -bond0 > /sys/class/net/bonding_masters bond_uninit() bond_debug_unregister() if (!bonding_debug_root) CPU1 bonding_debug_root = NULL; So do NOT revert the bad commit (since the removed checks were racy anyway), and instead change the order of actions taken during module removal. The same oops can also happen if there is an error during module init, so apply the same fix there. The Linux kernel CVE team has assigned CVE-2024-39296 to this issue. Affected and fixed versions =========================== Issue introduced in 6.6 with commit cc317ea3d927 and fixed in 6.6.34 with commit f07224c16678 Issue introduced in 6.6 with commit cc317ea3d927 and fixed in 6.9.5 with commit cf48aee81103 Issue introduced in 6.6 with commit cc317ea3d927 and fixed in 6.10-rc1 with commit a45835a0bb6e 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-2024-39296 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: drivers/net/bonding/bond_main.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/f07224c16678a8af54ddc059b3d2d51885d7f35e https://git.kernel.org/stable/c/cf48aee81103ca06d09d73d33fb72f1191069aa6 https://git.kernel.org/stable/c/a45835a0bb6ef7d5ddbc0714dd760de979cb6ece