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 A404D212D9E for ; Wed, 26 Feb 2025 02:00:29 +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=1740535229; cv=none; b=bLuoWMi53CtdKphM9RFKzPzwm2reydtVzOQz2eo1t6WovJWh1SwR3sv8aBCGCNbQeBidTfFkgTHed/Umo7+zr3dff4uw+9O6fZx+6N9bil9JZY02yKMBFkX8ZGKMS/ubvjB4prJbkDfzZ/qBI8H+f2NdbajYCiUyiv+fXOyu0P8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740535229; c=relaxed/simple; bh=+BJB1J1CjGo/W7r2DUifdUJuA2VXJTUhC8o1BdrjSmo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=NrxUsa3CwlVgp+RVas/h9/XAwQ3+zzf0NmOGkY1g2igL/kgYPJQKgSSf7v5Kl4HY3hAAfLMet21RfBFcB7chcurtTSA4ym9VKlbD/nor7TXjyQ/Y2p0tmUDSxWzII9eNVfUbPJgUnUed6A8qBR5PQRgi8nTx/TfxKyIniYyM4IQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=riDgD3m4; 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="riDgD3m4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78314C4CEDD; Wed, 26 Feb 2025 02:00:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740535229; bh=+BJB1J1CjGo/W7r2DUifdUJuA2VXJTUhC8o1BdrjSmo=; h=From:To:Cc:Subject:Date:Reply-to:From; b=riDgD3m4P7tNRNZsfDhCn9oaztLPyQTcIS5We6a6EJYgEFJER9x+dqPtO6pb4fucV 750pD/8ZbT1xvaAUcvPSerDDJN1HDiRa3t367chSzPNRKgmffkISzb8zgEWC1UGnlY M8J0MGlXD+YtnQdM9EUsHNIs3Sx6cJ1DRPqtBe3A= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49285: iio: accel: mma8452: use the correct logic to get mma8452_data Date: Wed, 26 Feb 2025 02:58:10 +0100 Message-ID: <2025022632-CVE-2022-49285-627c@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=2848; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=+BJB1J1CjGo/W7r2DUifdUJuA2VXJTUhC8o1BdrjSmo=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7SiKCnk/YqJyQ4TGJm8///+8JDEcfv9T9PP/j6wKWe zL9XfE9HbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjARx9kM8wM/nqr8mNMeef8m k3Bh6vEz3LtXFTIsOJH7Vkpc+VF3pOvaB1K3cu7lTH6xFwA= 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: iio: accel: mma8452: use the correct logic to get mma8452_data The original logic to get mma8452_data is wrong, the *dev point to the device belong to iio_dev. we can't use this dev to find the correct i2c_client. The original logic happen to work because it finally use dev->driver_data to get iio_dev. Here use the API to_i2c_client() is wrong and make reader confuse. To correct the logic, it should be like this struct mma8452_data *data = iio_priv(dev_get_drvdata(dev)); But after commit 8b7651f25962 ("iio: iio_device_alloc(): Remove unnecessary self drvdata"), the upper logic also can't work. When try to show the avialable scale in userspace, will meet kernel dump, kernel handle NULL pointer dereference. So use dev_to_iio_dev() to correct the logic. Dual fixes tags as the second reflects when the bug was exposed, whilst the first reflects when the original bug was introduced. The Linux kernel CVE team has assigned CVE-2022-49285 to this issue. Affected and fixed versions =========================== Issue introduced in 4.4 with commit c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527 and fixed in 5.15.54 with commit 4c0bb583a4444cce224e8661090cbffc98e2fe07 Issue introduced in 4.4 with commit c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527 and fixed in 5.17.2 with commit d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf Issue introduced in 4.4 with commit c3cdd6e48e35b7a02f28e301ef30a87ff3cd6527 and fixed in 5.18 with commit c87b7b12f48db86ac9909894f4dc0107d7df6375 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-49285 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/iio/accel/mma8452.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/4c0bb583a4444cce224e8661090cbffc98e2fe07 https://git.kernel.org/stable/c/d2d9ebdbff79d87d27652578e6d1638ad3b5f3bf https://git.kernel.org/stable/c/c87b7b12f48db86ac9909894f4dc0107d7df6375