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 25B4014264C for ; Tue, 21 May 2024 14:40:15 +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=1716302415; cv=none; b=TFPzUEQJQBbLqJaLAM+R26Cldlx0rG0tFok7GGepaPxVn/leOShz7cIeKdqq6kYw4B6Ovf0vWIQXcvG7xEdS5K9ZIfZKwE58bypEBMWngf2pjXAnthdvu7K3mYRvTUguzPlO2n52oUf4y6UXpFKCWVg1VspdZ6/sCuB9edzVcnk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716302415; c=relaxed/simple; bh=/KCQV10r+Y3txZauQCjfFsqb8rGpO/xiB4vr7YR5HfY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=oKAuUbEwKRWvk3+valbrro4Qa74qaP8UUySvapOlV+Em5R3RD6yO5ekTiXaNxFwUuLC5Hvj9OTzAu1bz/+ufzfnhDCKnB3IBwfclBJrRAO99x/LWMzamunsG9UVLuX0mjZqeHl6cJ0JBQ0Qrsdbhx7v30lhc0gPN3ysghLq6xuI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CFyhIZf1; 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="CFyhIZf1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FC35C32786; Tue, 21 May 2024 14:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716302415; bh=/KCQV10r+Y3txZauQCjfFsqb8rGpO/xiB4vr7YR5HfY=; h=From:To:Cc:Subject:Date:Reply-to:From; b=CFyhIZf1o5cEdGCpzQqBzbtOhXRhKWwQQzWUJgycLdvihh+X2X2BQ7bloKNluTIYP b8SLnhNP1KOuc2T/1r/jPGty6slTritKLLy3ypU2xBq7cS7igq8CFvi5ub/ceDFke4 HmaZo7cybWPwXAud4nbKm33NfWl7JgQ3HMiNQ3yY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47349: mwifiex: bring down link before deleting interface Date: Tue, 21 May 2024 16:36:23 +0200 Message-ID: <2024052140-CVE-2021-47349-9828@gregkh> X-Mailer: git-send-email 2.45.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=4352; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=/KCQV10r+Y3txZauQCjfFsqb8rGpO/xiB4vr7YR5HfY=; b=owGbwMvMwCRo6H6F97bub03G02pJDGk+G20MWxcbfJrVXr9MXzSBobZpxt5E88VaKewxn7Sd+ hQim5U6YlkYBJkYZMUUWb5s4zm6v+KQopeh7WmYOaxMIEMYuDgFYCJsDxkWdAUHiXxz/ZU+PTRJ +9Ov70Vtc6+FM8zTrzjGJCK+fBvzS0Xeay9LehcHzhMFAA== 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: mwifiex: bring down link before deleting interface We can deadlock when rmmod'ing the driver or going through firmware reset, because the cfg80211_unregister_wdev() has to bring down the link for us, ... which then grab the same wiphy lock. nl80211_del_interface() already handles a very similar case, with a nice description: /* * We hold RTNL, so this is safe, without RTNL opencount cannot * reach 0, and thus the rdev cannot be deleted. * * We need to do it for the dev_close(), since that will call * the netdev notifiers, and we need to acquire the mutex there * but don't know if we get there from here or from some other * place (e.g. "ip link set ... down"). */ mutex_unlock(&rdev->wiphy.mtx); ... Do similarly for mwifiex teardown, by ensuring we bring the link down first. Sample deadlock trace: [ 247.103516] INFO: task rmmod:2119 blocked for more than 123 seconds. [ 247.110630] Not tainted 5.12.4 #5 [ 247.115796] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 247.124557] task:rmmod state:D stack: 0 pid: 2119 ppid: 2114 flags:0x00400208 [ 247.133905] Call trace: [ 247.136644] __switch_to+0x130/0x170 [ 247.140643] __schedule+0x714/0xa0c [ 247.144548] schedule_preempt_disabled+0x88/0xf4 [ 247.149714] __mutex_lock_common+0x43c/0x750 [ 247.154496] mutex_lock_nested+0x5c/0x68 [ 247.158884] cfg80211_netdev_notifier_call+0x280/0x4e0 [cfg80211] [ 247.165769] raw_notifier_call_chain+0x4c/0x78 [ 247.170742] call_netdevice_notifiers_info+0x68/0xa4 [ 247.176305] __dev_close_many+0x7c/0x138 [ 247.180693] dev_close_many+0x7c/0x10c [ 247.184893] unregister_netdevice_many+0xfc/0x654 [ 247.190158] unregister_netdevice_queue+0xb4/0xe0 [ 247.195424] _cfg80211_unregister_wdev+0xa4/0x204 [cfg80211] [ 247.201816] cfg80211_unregister_wdev+0x20/0x2c [cfg80211] [ 247.208016] mwifiex_del_virtual_intf+0xc8/0x188 [mwifiex] [ 247.214174] mwifiex_uninit_sw+0x158/0x1b0 [mwifiex] [ 247.219747] mwifiex_remove_card+0x38/0xa0 [mwifiex] [ 247.225316] mwifiex_pcie_remove+0xd0/0xe0 [mwifiex_pcie] [ 247.231451] pci_device_remove+0x50/0xe0 [ 247.235849] device_release_driver_internal+0x110/0x1b0 [ 247.241701] driver_detach+0x5c/0x9c [ 247.245704] bus_remove_driver+0x84/0xb8 [ 247.250095] driver_unregister+0x3c/0x60 [ 247.254486] pci_unregister_driver+0x2c/0x90 [ 247.259267] cleanup_module+0x18/0xcdc [mwifiex_pcie] The Linux kernel CVE team has assigned CVE-2021-47349 to this issue. Affected and fixed versions =========================== Issue introduced in 5.12 with commit a05829a7222e and fixed in 5.12.18 with commit a3041d39d3c1 Issue introduced in 5.12 with commit a05829a7222e and fixed in 5.13.3 with commit 35af69c7c049 Issue introduced in 5.12 with commit a05829a7222e and fixed in 5.14 with commit 1f9482aa8d41 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-2021-47349 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/wireless/marvell/mwifiex/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/a3041d39d3c14da97fa3476835aba043ba810cf0 https://git.kernel.org/stable/c/35af69c7c0490fdccfc159c6a87e4d1dc070838a https://git.kernel.org/stable/c/1f9482aa8d412b4ba06ce6ab8e333fb8ca29a06e