From mboxrd@z Thu Jan 1 00:00:00 1970 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 09A491F471A for ; Fri, 27 Dec 2024 14:12:09 +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=1735308730; cv=none; b=D2+pxmp26WfTVl9Y5kh3DFKeffvWkoe3jxa/M3KTQYXItXZnthUhbDkJMhuY5fjmZ8B07FDNDegmwDMkJ9VYPnJM55LzphuEIsigbjhSGr0N9Fv9v4sn3VSHxLlUHBr0lPzZssXWtkn0vv/f5XC/k1ReAmt05ctRxLbJxulAKuo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735308730; c=relaxed/simple; bh=Macmr8Bp616ZGgvjLTFyBafKLMLL+NkC4KLARhemWGo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UOzG4bvR30RND7vQL1LK92TsrpJhra8ARhuy5roSta5kububkfya7gGDFHYGcI46H3eTGSvwrl/+9I3zbBY2wzbbvWdDhCjhi6qkcAXguIONRiHgN14kVPL0AUAFcrVLKVUAX5Xl8QSOlEjFugTTaZ1xmj/E16YRitU+bNCDgyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Jk1osoLP; 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="Jk1osoLP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 607F6C4CED0; Fri, 27 Dec 2024 14:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735308729; bh=Macmr8Bp616ZGgvjLTFyBafKLMLL+NkC4KLARhemWGo=; h=From:To:Cc:Subject:Date:Reply-to:From; b=Jk1osoLPhs/GU04dIlFqTvuB/0mn180VK/SBq2gIiBmUMccq8sNjv9PfFAXEFOaFW La9CdupgXVup2z0sZtQs+LZV/Zh/tNHpXCGGawZG1sE4aHaTPsvwWqLck1qnhR3iGV OvpFhNF/uLvHJhcj0TN7elBoXCJFL6sOM5sJLj5E= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-56549: cachefiles: Fix NULL pointer dereference in object->file Date: Fri, 27 Dec 2024 15:11:40 +0100 Message-ID: <2024122730-CVE-2024-56549-ebcd@gregkh> X-Mailer: git-send-email 2.47.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=2822; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Macmr8Bp616ZGgvjLTFyBafKLMLL+NkC4KLARhemWGo=; b=owGbwMvMwCRo6H6F97bub03G02pJDOl5WycJb7FvKfJmZdzb4FF9rsdNmtvvQckLjatcE7vUG 199VF/cEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABN5Ws4wzyStVcj7rOB3txP8 mZ8Psp3JuLkumGGuuKjQ8237Q/a7Bm97ryRdmsYrt+YnAA== 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: cachefiles: Fix NULL pointer dereference in object->file At present, the object->file has the NULL pointer dereference problem in ondemand-mode. The root cause is that the allocated fd and object->file lifetime are inconsistent, and the user-space invocation to anon_fd uses object->file. Following is the process that triggers the issue: [write fd] [umount] cachefiles_ondemand_fd_write_iter fscache_cookie_state_machine cachefiles_withdraw_cookie if (!file) return -ENOBUFS cachefiles_clean_up_object cachefiles_unmark_inode_in_use fput(object->file) object->file = NULL // file NULL pointer dereference! __cachefiles_write(..., file, ...) Fix this issue by add an additional reference count to the object->file before write/llseek, and decrement after it finished. The Linux kernel CVE team has assigned CVE-2024-56549 to this issue. Affected and fixed versions =========================== Issue introduced in 5.19 with commit c8383054506c77b814489c09877b5db83fd4abf2 and fixed in 6.11.11 with commit f98770440c9bc468e2fd878212ec9526dbe08293 Issue introduced in 5.19 with commit c8383054506c77b814489c09877b5db83fd4abf2 and fixed in 6.12.2 with commit 9582c7664103c9043e80a78f5c382aa6bdd67418 Issue introduced in 5.19 with commit c8383054506c77b814489c09877b5db83fd4abf2 and fixed in 6.13-rc1 with commit 31ad74b20227ce6b40910ff78b1c604e42975cf1 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-56549 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/cachefiles/interface.c fs/cachefiles/ondemand.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/f98770440c9bc468e2fd878212ec9526dbe08293 https://git.kernel.org/stable/c/9582c7664103c9043e80a78f5c382aa6bdd67418 https://git.kernel.org/stable/c/31ad74b20227ce6b40910ff78b1c604e42975cf1