From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6B0AA3195FD; Sun, 7 Jun 2026 10:37:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828680; cv=none; b=VNsaKvXFutKfJgC6RZ1aP76Q6Wsb7SyXjfhuOK8EmjMQ8TF4hvAq+Py/YZrI0QWgTn62p3vDLxBOfxMkzDkPzvtkI4XsQUQ3OnIS36NmLWLJ+ETvFffzMq7BcOFWhej/zg8n4mIcyV2H5TS+MGze4jlvCRsLa1Pr2U3949LJ/L8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828680; c=relaxed/simple; bh=EAHFNTIjiHKCOQsV9Hrf2QfB+tbyvIkiykQ8OAnEpzo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PEuZ3pfx410THkQmOenJl9/hQSZxZSJezK2tRywqD0U8AcI31u3PWViXAELGhHQ8lZU1J8Hd9XYXnSe4dmf8m5nz1Gmw6rxla09yi74KXkCBRuE09Ceag0oc3ahOwv2ChgGCE8lwJZSRWH8KbhKP+soKy7TkJR0pYzhbf8CxrcE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=tszCTuVG; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="tszCTuVG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B33DB1F00893; Sun, 7 Jun 2026 10:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780828679; bh=VXOF/UfZ7FaUv/omEKc5qfNP8AlThEqsg8VjLzXyOFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=tszCTuVGGT5eZN4wKLRZXSZ1jxSecNz79HlPy6a9KuwbQBTclQTUtSaAIolVjF+nR 42pWwYKJQQOwarKkgiiZ37t+75YNNK0iyKuCnmVaIgGEKUVzV6Hg6AY+3yWfrPK0M9 56PwgD7FO+miGCgIQlhMJVkFNkL4gd5VKuteB8SU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Carlier , Andy Shevchenko , Jonathan Cameron Subject: [PATCH 6.18 164/315] iio: gyro: itg3200: fix i2c read into the wrong stack location Date: Sun, 7 Jun 2026 11:59:11 +0200 Message-ID: <20260607095733.616223469@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.528828913@linuxfoundation.org> References: <20260607095727.528828913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Carlier commit 6bdc3023d62ed5c7d591f0eb27a5adb37fb892ae upstream. itg3200_read_all_channels() takes `__be16 *buf' as a parameter and fills the i2c_msg destination as `(char *)&buf'. Since `buf' is the parameter (a pointer), `&buf' is the address of the local pointer slot on the stack of itg3200_read_all_channels(), not the address of the caller's scan buffer. The (char *) cast hides the type mismatch. i2c_transfer() therefore writes ITG3200_SCAN_ELEMENTS * sizeof(s16) = 8 bytes into the parameter's stack slot, which is discarded when the function returns. The caller's scan buffer in itg3200_trigger_handler() is never written to, so iio_push_to_buffers_with_timestamp() pushes uninitialised stack contents to userspace via /dev/iio:deviceX every scan -- both a functional bug (no actual gyroscope or temperature data is delivered through the triggered buffer) and an information leak. The non-buffered read_raw() path is unaffected: it goes through itg3200_read_reg_s16() which uses `&out' on a local s16 value, where that is correct. Drop the spurious `&' so the i2c read writes into the caller's buffer. Fixes: 9dbf091da080 ("iio: gyro: Add itg3200") Cc: stable@vger.kernel.org Signed-off-by: David Carlier Reviewed-by: Andy Shevchenko Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/gyro/itg3200_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/gyro/itg3200_buffer.c +++ b/drivers/iio/gyro/itg3200_buffer.c @@ -34,7 +34,7 @@ static int itg3200_read_all_channels(str .addr = i2c->addr, .flags = i2c->flags | I2C_M_RD, .len = ITG3200_SCAN_ELEMENTS * sizeof(s16), - .buf = (char *)&buf, + .buf = (char *)buf, }, };