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 BCA44217711 for ; Wed, 26 Feb 2025 02:15:17 +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=1740536117; cv=none; b=TJmQkm/qsEBNg/kms0Jwr0n3erPaxOGQylHXWWnEG58lQ65bNviLX6HD93iW1Duioea7Pbpajm6xvhQhSZAPEcw3jGGxu4H5B80LRQI+sRKKmBRT/KhmCzV/bMtR6dSCn865It22iqIZmkjDv1thapgzv0czZj0D/ZIxkyMAITo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740536117; c=relaxed/simple; bh=z5fqkvHIFDXmbSx2u3NCOzClxKShHpK6zK/99DX4ekc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=a9nEjAZzezdc637xWK1DMX27Saj2cuhYivTUsww7p45BY2bn5yHraX3Cns/i0I8Z7pTVcunjVm/18IJwnPUD8bfDGGCg7oAB3ULuJBgfl0DcNcgubqcUMiz0BtiJcUH+XVRudPwtY7PXoN1p4HBbn8E6ni2Y/tonhER9DeK6Q+U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HWFtGPYy; 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="HWFtGPYy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96177C4CEDD; Wed, 26 Feb 2025 02:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740536117; bh=z5fqkvHIFDXmbSx2u3NCOzClxKShHpK6zK/99DX4ekc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=HWFtGPYy/BLT+OtJRjpD4veMZ/6pmpNjybu66bj7h3mU3K0cgGWDiqeMY6q4UXmNY vMzZhtjBgvZrZ5vMVwoipfnG+M7lXRmBbZH30hBQxFQmNvw3sp6rwARIzyvArR8I1F CDSW9Z92umjYsOfoLWEy9XhW7QkPZ/hUUCMttoa0= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49519: ath10k: skip ath10k_halt during suspend for driver state RESTARTING Date: Wed, 26 Feb 2025 03:13:13 +0100 Message-ID: <2025022610-CVE-2022-49519-3b0d@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=4714; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=z5fqkvHIFDXmbSx2u3NCOzClxKShHpK6zK/99DX4ekc=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7Kpj6c4qet/pLrc6uTv4voPdbdqmGwas5v/tu3P6eV f6pZuWUjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIfUeG+U65diWh4b3sKmvX TTjaZLc5sTannmGeyty6fxyvC0odw5a9mfhI/PnKxM0eAA== 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: ath10k: skip ath10k_halt during suspend for driver state RESTARTING Double free crash is observed when FW recovery(caused by wmi timeout/crash) is followed by immediate suspend event. The FW recovery is triggered by ath10k_core_restart() which calls driver clean up via ath10k_halt(). When the suspend event occurs between the FW recovery, the restart worker thread is put into frozen state until suspend completes. The suspend event triggers ath10k_stop() which again triggers ath10k_halt() The double invocation of ath10k_halt() causes ath10k_htt_rx_free() to be called twice(Note: ath10k_htt_rx_alloc was not called by restart worker thread because of its frozen state), causing the crash. To fix this, during the suspend flow, skip call to ath10k_halt() in ath10k_stop() when the current driver state is ATH10K_STATE_RESTARTING. Also, for driver state ATH10K_STATE_RESTARTING, call ath10k_wait_for_suspend() in ath10k_stop(). This is because call to ath10k_wait_for_suspend() is skipped later in [ath10k_halt() > ath10k_core_stop()] for the driver state ATH10K_STATE_RESTARTING. The frozen restart worker thread will be cancelled during resume when the device comes out of suspend. Below is the crash stack for reference: [ 428.469167] ------------[ cut here ]------------ [ 428.469180] kernel BUG at mm/slub.c:4150! [ 428.469193] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [ 428.469219] Workqueue: events_unbound async_run_entry_fn [ 428.469230] RIP: 0010:kfree+0x319/0x31b [ 428.469241] RSP: 0018:ffffa1fac015fc30 EFLAGS: 00010246 [ 428.469247] RAX: ffffedb10419d108 RBX: ffff8c05262b0000 [ 428.469252] RDX: ffff8c04a8c07000 RSI: 0000000000000000 [ 428.469256] RBP: ffffa1fac015fc78 R08: 0000000000000000 [ 428.469276] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 428.469285] Call Trace: [ 428.469295] ? dma_free_attrs+0x5f/0x7d [ 428.469320] ath10k_core_stop+0x5b/0x6f [ 428.469336] ath10k_halt+0x126/0x177 [ 428.469352] ath10k_stop+0x41/0x7e [ 428.469387] drv_stop+0x88/0x10e [ 428.469410] __ieee80211_suspend+0x297/0x411 [ 428.469441] rdev_suspend+0x6e/0xd0 [ 428.469462] wiphy_suspend+0xb1/0x105 [ 428.469483] ? name_show+0x2d/0x2d [ 428.469490] dpm_run_callback+0x8c/0x126 [ 428.469511] ? name_show+0x2d/0x2d [ 428.469517] __device_suspend+0x2e7/0x41b [ 428.469523] async_suspend+0x1f/0x93 [ 428.469529] async_run_entry_fn+0x3d/0xd1 [ 428.469535] process_one_work+0x1b1/0x329 [ 428.469541] worker_thread+0x213/0x372 [ 428.469547] kthread+0x150/0x15f [ 428.469552] ? pr_cont_work+0x58/0x58 [ 428.469558] ? kthread_blkcg+0x31/0x31 Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1 The Linux kernel CVE team has assigned CVE-2022-49519 to this issue. Affected and fixed versions =========================== Fixed in 5.10.121 with commit 8aa3750986ffcf73e0692db3b40dd3a8e8c0c575 Fixed in 5.15.46 with commit c2272428090d0d215a3f017cbbbad731c07eee53 Fixed in 5.17.14 with commit 7eb14cb604f49e58b7cf6faa87961a865a3c8649 Fixed in 5.18.3 with commit 5321e5211b5dc873e2e3d0deb749e69ecf4dbfe5 Fixed in 5.19 with commit b72a4aff947ba807177bdabb43debaf2c66bee05 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-49519 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/ath/ath10k/mac.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/8aa3750986ffcf73e0692db3b40dd3a8e8c0c575 https://git.kernel.org/stable/c/c2272428090d0d215a3f017cbbbad731c07eee53 https://git.kernel.org/stable/c/7eb14cb604f49e58b7cf6faa87961a865a3c8649 https://git.kernel.org/stable/c/5321e5211b5dc873e2e3d0deb749e69ecf4dbfe5 https://git.kernel.org/stable/c/b72a4aff947ba807177bdabb43debaf2c66bee05