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 727F5149C42 for ; Wed, 3 Apr 2024 14:57:33 +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=1712156253; cv=none; b=oGedoM7VxhbNt5RxszFvVEPBrcnmFnF/nqJoFasMNA8qcXAhNoZDmLWSab59QGUxPdicplQgBmu5TlxExzU8AEEInEaWx1RwfnYwu1g/czr00ebojijKs39FiChetrVWBJdTVKsSONX2fryktoSxlutdZhgxgScEMXJd9qXUQ+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712156253; c=relaxed/simple; bh=hKEY9FbrPmdmsNgErhg/5XE3O6usPsgawnrCeGy7yUw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=s/w6FwqOf2y60Er1dO8IT8RCW7wujPaFjLnL3DuGzypITVCW9AF9OwakRUlRnh/mgMw5pJMYg9omiTWlaQwCKvtd2AtB6giwwRd347IMDQ1a1I7t8zMlg+MHuZV1Q6wc5czxS1g0xjEUmoLB34mtvgy2VqkerpwgXtDMXbl5d4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lqmAY9Ah; 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="lqmAY9Ah" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5980C433F1; Wed, 3 Apr 2024 14:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712156253; bh=hKEY9FbrPmdmsNgErhg/5XE3O6usPsgawnrCeGy7yUw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=lqmAY9AhZQ+yOaEnGfc9cPShw/fXVL5AyT88KlKGDEDseB1MU38t/IlaXTykQL9Zf X6xqZU3rUcb7fo9yolpI5VlNSpf1XqItZEq/oRxVBpNqBFhdBmY+yDRT7ibes8nZtM ZQSbRrElCJdCS3jWScGsNpCNPfb834mndgROpTuQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-26689: ceph: prevent use-after-free in encode_cap_msg() Date: Wed, 3 Apr 2024 16:55:40 +0200 Message-ID: <2024040336-CVE-2024-26689-990b@gregkh> X-Mailer: git-send-email 2.44.0 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=2731; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=hKEY9FbrPmdmsNgErhg/5XE3O6usPsgawnrCeGy7yUw=; b=owGbwMvMwCRo6H6F97bub03G02pJDGm8uS82ZF9Y6+gluk7dfeLei+lXBE2WbuSaOK9qnbvY8 lifaccXdcSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBESk8wzGT8o2qXFC9fFHky cOLv7/fcmAU7bBkWXDnbeuyofLiTd9orp0X5bR9P5ui+AwA= 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: ceph: prevent use-after-free in encode_cap_msg() In fs/ceph/caps.c, in encode_cap_msg(), "use after free" error was caught by KASAN at this line - 'ceph_buffer_get(arg->xattr_buf);'. This implies before the refcount could be increment here, it was freed. In same file, in "handle_cap_grant()" refcount is decremented by this line - 'ceph_buffer_put(ci->i_xattrs.blob);'. It appears that a race occurred and resource was freed by the latter line before the former line could increment it. encode_cap_msg() is called by __send_cap() and __send_cap() is called by ceph_check_caps() after calling __prep_cap(). __prep_cap() is where arg->xattr_buf is assigned to ci->i_xattrs.blob. This is the spot where the refcount must be increased to prevent "use after free" error. The Linux kernel CVE team has assigned CVE-2024-26689 to this issue. Affected and fixed versions =========================== Fixed in 5.10.210 with commit 8180d0c27b93 Fixed in 5.15.149 with commit 70e329b44076 Fixed in 6.1.79 with commit f3f98d7d84b3 Fixed in 6.6.18 with commit ae20db45e482 Fixed in 6.7.6 with commit 7958c1bf5b03 Fixed in 6.8 with commit cda4672da1c2 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-2024-26689 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/ceph/caps.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/8180d0c27b93a6eb60da1b08ea079e3926328214 https://git.kernel.org/stable/c/70e329b440762390258a6fe8c0de93c9fdd56c77 https://git.kernel.org/stable/c/f3f98d7d84b31828004545e29fd7262b9f444139 https://git.kernel.org/stable/c/ae20db45e482303a20e56f2db667a9d9c54ac7e7 https://git.kernel.org/stable/c/7958c1bf5b03c6f1f58e724dbdec93f8f60b96fc https://git.kernel.org/stable/c/cda4672da1c26835dcbd7aec2bfed954eda9b5ef