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 70BB625569 for ; Wed, 19 Jun 2024 14:55:28 +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=1718808928; cv=none; b=FEujbIiWaz2d0ogYqKnFTLhqTqCEOim1evcPM61LcSvHMAX1wqCtIAeMt9niGRjYgsIu5GHqrgPAdkTJb0nWCRKZEf0gKFBEw8/xGazWimz9qOG9vPwamxj2j1TZi2eYI8NTxflOwOoQefzZAgpkNTfnpmlkYAJx61ijDbMJv/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718808928; c=relaxed/simple; bh=kgHknxpur3kDOX3AovjYNXAONjj+W6H6yqxTyqjkxxU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cufbScOBLLgcGrdgMDZqcVaEmkuYwyxzQnQLHkIPHUgOwa3Xc40U0jzcX1x7uI4zF+rDGeW9hi+0LLHDNeJG1JFlO3IQJ2HkXHpCzSNxad85QVi4cQadEgKw247hXEwizdx1VdVJ/XNZgaCluIdtwCaZDCoWEcZIPk/Wl7xUJr0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Lp6bH4fe; 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="Lp6bH4fe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DEAEC2BBFC; Wed, 19 Jun 2024 14:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718808927; bh=kgHknxpur3kDOX3AovjYNXAONjj+W6H6yqxTyqjkxxU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=Lp6bH4fesSHjsJF1zA/fKp/FQXFLeYO83gDK+GN+lf6YTLQ2POcnbidN1iX5w65uq zvcIPZ7DQ+/p3VBSu24EwX3C42nkR1nB+b9RagWWS8nyquyvKcl9DcoDQJODaV8WZu sthYq+ZV3uL1XQPQcvxZz0romV/n3QnMgZNmJX3k= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47599: btrfs: use latest_dev in btrfs_show_devname Date: Wed, 19 Jun 2024 16:54:38 +0200 Message-ID: <2024061921-CVE-2021-47599-37b9@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=2747; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=kgHknxpur3kDOX3AovjYNXAONjj+W6H6yqxTyqjkxxU=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlFH2WDlvtNfBd1XmP3/gTlrbeFVx+qcL6x0MawIDHpw uJ3Gzlud8SyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBE5k9jmB+ku7YwUO+T23yO sxyuinyXlLcce8CwYL74dkGf+p3V7evLqjXtbzHe9ar9AAA= 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: btrfs: use latest_dev in btrfs_show_devname The test case btrfs/238 reports the warning below: WARNING: CPU: 3 PID: 481 at fs/btrfs/super.c:2509 btrfs_show_devname+0x104/0x1e8 [btrfs] CPU: 2 PID: 1 Comm: systemd Tainted: G W O 5.14.0-rc1-custom #72 Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015 Call trace: btrfs_show_devname+0x108/0x1b4 [btrfs] show_mountinfo+0x234/0x2c4 m_show+0x28/0x34 seq_read_iter+0x12c/0x3c4 vfs_read+0x29c/0x2c8 ksys_read+0x80/0xec __arm64_sys_read+0x28/0x34 invoke_syscall+0x50/0xf8 do_el0_svc+0x88/0x138 el0_svc+0x2c/0x8c el0t_64_sync_handler+0x84/0xe4 el0t_64_sync+0x198/0x19c Reason: While btrfs_prepare_sprout() moves the fs_devices::devices into fs_devices::seed_list, the btrfs_show_devname() searches for the devices and found none, leading to the warning as in above. Fix: latest_dev is updated according to the changes to the device list. That means we could use the latest_dev->name to show the device name in /proc/self/mounts, the pointer will be always valid as it's assigned before the device is deleted from the list in remove or replace. The RCU protection is sufficient as the device structure is freed after synchronization. The Linux kernel CVE team has assigned CVE-2021-47599 to this issue. Affected and fixed versions =========================== Fixed in 5.15.11 with commit e342c2558016 Fixed in 5.16 with commit 6605fd2f394b 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-47599 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: fs/btrfs/super.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/e342c2558016ead462f376b6c6c2ac5efc17f3b1 https://git.kernel.org/stable/c/6605fd2f394bba0a0059df2b6cfc87b0b6d393a2