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 067BF199242 for ; Tue, 16 Jul 2024 11:46:38 +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=1721130398; cv=none; b=Hx3dQe2s+kqQkibH91xoP5PBVk/Rqc7YmfUM0SAC6N3iKmvBisJEgoOjqBHJHDSLfWC2S7buZ+bnx/+bdJmr79kEadfTQ6HAXCuwi/uVNfp4rFYL6CNRRL3aMC2vuoHjBmsDotPesWmnUkz8JWiHZy7R3pi0RYHpo3zWgAsOEso= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721130398; c=relaxed/simple; bh=gppvy6qSZLkwdqEW41UWUzn4T6PUs5IoROU3x/yNGfY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=L/B7VvtHLNiZ1ta7uKAZFUuNEor5n1rQdYH+VJvTH7SGXtLA9SzpbY2C8pjIliKg7YvTq7vmOAdFYQ+PI3SZgFU7VOIjaXkYTcwsLgv+kCC6BSDqUQuo2dERrvHtNv/Z0eoZtm4KYkhaDeG1fr1I7FEMjV/aFWnWmf11sbZNikk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MPCihNAR; 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="MPCihNAR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AFD4C116B1; Tue, 16 Jul 2024 11:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1721130397; bh=gppvy6qSZLkwdqEW41UWUzn4T6PUs5IoROU3x/yNGfY=; h=From:To:Cc:Subject:Date:Reply-to:From; b=MPCihNARpu+0eSzSnA66NZMk6e2K4hqui4Vo5DmJiZVmI0a9mdps9XL71RmIvNcxS arr+sf0x+Y9nX5hvlFFI58bB5eyysnaGiv2N1LYRDKNvH/HLA4yKADgMHB6nuqw1A1 2jq8sS8QU/7xas5j+FqcnnQ/6/OLe5ElttWtcJcs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48808: net: dsa: fix panic when DSA master device unbinds on shutdown Date: Tue, 16 Jul 2024 13:46:00 +0200 Message-ID: <2024071646-CVE-2022-48808-a6fe@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=4416; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=gppvy6qSZLkwdqEW41UWUzn4T6PUs5IoROU3x/yNGfY=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnTYrMmfWKJOeTXt7MhW2NmxoJrgWfuXXsYKdfbwm1Ru qC4fkpURywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAExE6h7DPKsPew/vulI8JbRz yy3B39zST/fkmjPMjyivPyXd58VfdZW/TJK3K9BPhLMOAA== 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: dsa: fix panic when DSA master device unbinds on shutdown Rafael reports that on a system with LX2160A and Marvell DSA switches, if a reboot occurs while the DSA master (dpaa2-eth) is up, the following panic can be seen: systemd-shutdown[1]: Rebooting. Unable to handle kernel paging request at virtual address 00a0000800000041 [00a0000800000041] address between user and kernel address ranges Internal error: Oops: 96000004 [#1] PREEMPT SMP CPU: 6 PID: 1 Comm: systemd-shutdow Not tainted 5.16.5-00042-g8f5585009b24 #32 pc : dsa_slave_netdevice_event+0x130/0x3e4 lr : raw_notifier_call_chain+0x50/0x6c Call trace: dsa_slave_netdevice_event+0x130/0x3e4 raw_notifier_call_chain+0x50/0x6c call_netdevice_notifiers_info+0x54/0xa0 __dev_close_many+0x50/0x130 dev_close_many+0x84/0x120 unregister_netdevice_many+0x130/0x710 unregister_netdevice_queue+0x8c/0xd0 unregister_netdev+0x20/0x30 dpaa2_eth_remove+0x68/0x190 fsl_mc_driver_remove+0x20/0x5c __device_release_driver+0x21c/0x220 device_release_driver_internal+0xac/0xb0 device_links_unbind_consumers+0xd4/0x100 __device_release_driver+0x94/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_device_remove+0x24/0x40 __fsl_mc_device_remove+0xc/0x20 device_for_each_child+0x58/0xa0 dprc_remove+0x90/0xb0 fsl_mc_driver_remove+0x20/0x5c __device_release_driver+0x21c/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_bus_remove+0x80/0x100 fsl_mc_bus_shutdown+0xc/0x1c platform_shutdown+0x20/0x30 device_shutdown+0x154/0x330 __do_sys_reboot+0x1cc/0x250 __arm64_sys_reboot+0x20/0x30 invoke_syscall.constprop.0+0x4c/0xe0 do_el0_svc+0x4c/0x150 el0_svc+0x24/0xb0 el0t_64_sync_handler+0xa8/0xb0 el0t_64_sync+0x178/0x17c It can be seen from the stack trace that the problem is that the deregistration of the master causes a dev_close(), which gets notified as NETDEV_GOING_DOWN to dsa_slave_netdevice_event(). But dsa_switch_shutdown() has already run, and this has unregistered the DSA slave interfaces, and yet, the NETDEV_GOING_DOWN handler attempts to call dev_close_many() on those slave interfaces, leading to the problem. The previous attempt to avoid the NETDEV_GOING_DOWN on the master after dsa_switch_shutdown() was called seems improper. Unregistering the slave interfaces is unnecessary and unhelpful. Instead, after the slaves have stopped being uppers of the DSA master, we can now reset to NULL the master->dsa_ptr pointer, which will make DSA start ignoring all future notifier events on the master. The Linux kernel CVE team has assigned CVE-2022-48808 to this issue. Affected and fixed versions =========================== Issue introduced in 5.15 with commit 0650bf52b31f and fixed in 5.15.155 with commit ff45899e732e Issue introduced in 5.15 with commit 0650bf52b31f and fixed in 5.16.10 with commit 89b60402d43c Issue introduced in 5.15 with commit 0650bf52b31f and fixed in 5.17 with commit ee534378f005 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-48808 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/dsa/dsa2.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/ff45899e732e57088985e3a497b1d9100571c0f5 https://git.kernel.org/stable/c/89b60402d43cdab4387dbbf24afebda5cf092ae7 https://git.kernel.org/stable/c/ee534378f00561207656663d93907583958339ae