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 BC4481B0F23 for ; Wed, 26 Feb 2025 02:00: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=1740535217; cv=none; b=DJhAw2/u/IowYd9Z0d2F+UEOiB102/aEe0FnArQGb3vGDoTugETQH9NTMOI59gD7vA2/btxu8aZlPabzyTIWEx4/Hhh72ibWa+PbvdgBsqedRec7tse+q5LpdO2P4ZUAgdat94F6cmbDK1qMdscO1rEAR45BBu0cS+7IW21xt8M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740535217; c=relaxed/simple; bh=i83D61xeIwM0JnbCA7fKniWM9je7HUR9mqo7Z8FcrEQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uo0W/CRNjlFwz9vHWt27RowgS/qhygX8SP6z20n4RYggmUZJrzUXMu4wd3raZP2dondrelsih6uUstFMirK8Pdmzasl65YngF8No0/1WWU0JT2U0siPxsZs6v5k+dqK+VLlGClzkQmQxTwztSg9Y7DpMTT2wTU/SYp8p3eDVd28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JYCoN6lg; 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="JYCoN6lg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 389B3C4CEDD; Wed, 26 Feb 2025 02:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740535217; bh=i83D61xeIwM0JnbCA7fKniWM9je7HUR9mqo7Z8FcrEQ=; h=From:To:Cc:Subject:Date:Reply-to:From; b=JYCoN6lgYq3zEZbQxjry2HBF6EIbnZfAy5SiTKv5ZMvdOKYnms8HTUxvu7InMOL6H 4phtVlr0Z07neVAsFwd139admPSGZnrhEh8BoYTWr/JUiyogM6mRlyrJLZaemCSvTN Ci1+wk+5Szrs4AutQxZzLr6zKJW+Smt7yZT5t9BA= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49270: dm: fix use-after-free in dm_cleanup_zoned_dev() Date: Wed, 26 Feb 2025 02:57:55 +0100 Message-ID: <2025022630-CVE-2022-49270-c331@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=3537; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=i83D61xeIwM0JnbCA7fKniWM9je7HUR9mqo7Z8FcrEQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7SsKc7sUxPW7/9tpdILdqfnr1GkYDpn9KSh/nyOw8c y1mAbdjRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzEppxhQRerBsvOq9N8Yll/ 9Pt8bWeKPKYRxjC/7MCBu5WGDExX7zN9XOAmbVo8lz8AAA== 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: dm: fix use-after-free in dm_cleanup_zoned_dev() dm_cleanup_zoned_dev() uses queue, so it must be called before blk_cleanup_disk() starts its killing: blk_cleanup_disk->blk_cleanup_queue()->kobject_put()->blk_release_queue()-> ->...RCU...->blk_free_queue_rcu()->kmem_cache_free() Otherwise, RCU callback may be executed first and dm_cleanup_zoned_dev() will touch free'd memory: BUG: KASAN: use-after-free in dm_cleanup_zoned_dev+0x33/0xd0 Read of size 8 at addr ffff88805ac6e430 by task dmsetup/681 CPU: 4 PID: 681 Comm: dmsetup Not tainted 5.17.0-rc2+ #6 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 Call Trace: dump_stack_lvl+0x57/0x7d print_address_description.constprop.0+0x1f/0x150 ? dm_cleanup_zoned_dev+0x33/0xd0 kasan_report.cold+0x7f/0x11b ? dm_cleanup_zoned_dev+0x33/0xd0 dm_cleanup_zoned_dev+0x33/0xd0 __dm_destroy+0x26a/0x400 ? dm_blk_ioctl+0x230/0x230 ? up_write+0xd8/0x270 dev_remove+0x156/0x1d0 ctl_ioctl+0x269/0x530 ? table_clear+0x140/0x140 ? lock_release+0xb2/0x750 ? remove_all+0x40/0x40 ? rcu_read_lock_sched_held+0x12/0x70 ? lock_downgrade+0x3c0/0x3c0 ? rcu_read_lock_sched_held+0x12/0x70 dm_ctl_ioctl+0xa/0x10 __x64_sys_ioctl+0xb9/0xf0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fb6dfa95c27 The Linux kernel CVE team has assigned CVE-2022-49270 to this issue. Affected and fixed versions =========================== Issue introduced in 5.14 with commit bb37d77239af25cde59693dbe3fac04dd17d7b29 and fixed in 5.15.33 with commit 0987f00a76a17aa7213da492c00ed9e5a6210c73 Issue introduced in 5.14 with commit bb37d77239af25cde59693dbe3fac04dd17d7b29 and fixed in 5.16.19 with commit fdfe414ca28ddfd562c233fb27385cf820de03e8 Issue introduced in 5.14 with commit bb37d77239af25cde59693dbe3fac04dd17d7b29 and fixed in 5.17.2 with commit 43a043aed964659bc69ef81f266912b73c80d837 Issue introduced in 5.14 with commit bb37d77239af25cde59693dbe3fac04dd17d7b29 and fixed in 5.18 with commit 588b7f5df0cb64f281290c7672470c006abe7160 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-49270 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/md/dm.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/0987f00a76a17aa7213da492c00ed9e5a6210c73 https://git.kernel.org/stable/c/fdfe414ca28ddfd562c233fb27385cf820de03e8 https://git.kernel.org/stable/c/43a043aed964659bc69ef81f266912b73c80d837 https://git.kernel.org/stable/c/588b7f5df0cb64f281290c7672470c006abe7160