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 C565E63A for ; Wed, 17 Apr 2024 10:30:14 +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=1713349814; cv=none; b=MGneA+ZBXVAJrHAyXUQ6lnNfgYV9CySYhJ+sH7W1aQ4r94l2v5XNWLHg2GBlcZbRvzwzppWIG46BMM8jn+WnFzbC9gP15N7J92xyDjr7eUM7H/0ZHTd4PISRRTOMJuaPPigwH9Cem1KNB7nxfa+KSg2rZpN8ojWPt18yq6F+FQI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713349814; c=relaxed/simple; bh=WDWH0JA5eLCsQyfOHnH2sk+3OYKPY7cDh2o3t+Vnbcg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=FeMJvH2VNYhVObbSHd1VAymYzYHR7YVbd58tj8qvXKC8oUQgkvQTYQ4Z+G5hkyLvysp7TRwiZzE9wR3ck1pFdqGzwK0QmYBniSIg1KKKR/QYvOyWc4YWJXjSQdtNN5euPKouiHAOyDpxkn8g2Mvq8Ocs95F3FBRrYhujrY61lDw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KGoiESwi; 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="KGoiESwi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 057B5C072AA; Wed, 17 Apr 2024 10:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1713349814; bh=WDWH0JA5eLCsQyfOHnH2sk+3OYKPY7cDh2o3t+Vnbcg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=KGoiESwiYPrPSNgpxXyYLX54z/OKx7r3HdQV9d7MEV4DpBjtJUi0fm1CExcGefS35 cCZmNXD+cYpxVUqRa7qSvJhiAwMBRTBJCs4IpCuSKUV0s2Tvkp8OOB/Eyh1lGK2fUc 5zD+hj2NBsRU+9vO3qUCC6elOF/PQoqvcv9SnADs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-26866: spi: lpspi: Avoid potential use-after-free in probe() Date: Wed, 17 Apr 2024 12:28:41 +0200 Message-ID: <2024041737-CVE-2024-26866-1e98@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=2931; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=WDWH0JA5eLCsQyfOHnH2sk+3OYKPY7cDh2o3t+Vnbcg=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnyS0IN73Us+6a6xsfhA2NL6ss9xidN/UpV3rRsV1qi1 Dc5IMqqI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACayJJxhwY6ErOOOnhFNyhsO CgatmhdUWPehiGHBnJa+uw9/Tazbs8W4OnrO+d8zbLy7AA== 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: spi: lpspi: Avoid potential use-after-free in probe() fsl_lpspi_probe() is allocating/disposing memory manually with spi_alloc_host()/spi_alloc_target(), but uses devm_spi_register_controller(). In case of error after the latter call the memory will be explicitly freed in the probe function by spi_controller_put() call, but used afterwards by "devm" management outside probe() (spi_unregister_controller() <- devm_spi_unregister() below). Unable to handle kernel NULL pointer dereference at virtual address 0000000000000070 ... Call trace: kernfs_find_ns kernfs_find_and_get_ns sysfs_remove_group sysfs_remove_groups device_remove_attrs device_del spi_unregister_controller devm_spi_unregister release_nodes devres_release_all really_probe driver_probe_device __device_attach_driver bus_for_each_drv __device_attach device_initial_probe bus_probe_device deferred_probe_work_func process_one_work worker_thread kthread ret_from_fork The Linux kernel CVE team has assigned CVE-2024-26866 to this issue. Affected and fixed versions =========================== Issue introduced in 4.10 with commit 5314987de5e5 and fixed in 6.6.23 with commit da83ed350e46 Issue introduced in 4.10 with commit 5314987de5e5 and fixed in 6.7.11 with commit 1543418e8278 Issue introduced in 4.10 with commit 5314987de5e5 and fixed in 6.8.2 with commit 996ce839606a Issue introduced in 4.10 with commit 5314987de5e5 and fixed in 6.9-rc1 with commit 2ae0ab0143fc 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-26866 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/spi/spi-fsl-lpspi.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/da83ed350e4604b976e94239b08d8e2e7eaee7ea https://git.kernel.org/stable/c/1543418e82789cc383cd36d41469983c64e3fc7f https://git.kernel.org/stable/c/996ce839606afd0fef91355627868022aa73eb68 https://git.kernel.org/stable/c/2ae0ab0143fcc06190713ed81a6486ed0ad3c861