Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4272234pxu; Mon, 12 Oct 2020 14:28:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiyzMDXmMvCAV0mtXUBE7e5I3ZANjw5l58BTXs2nWkYLoqvgSOn7KVZfwPZVtS5JPAUUby X-Received: by 2002:a50:fc0d:: with SMTP id i13mr16415593edr.122.1602538132055; Mon, 12 Oct 2020 14:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602538132; cv=none; d=google.com; s=arc-20160816; b=VVICANO3zwPiQxN5c81c5dr6gHc+1wU3PSjqNszFvW+rlx+rc6W/adw6CR2mW2K3eI Lt5eSJKmraXthF6ehNotDKiNGQEkfz4xEZiWr/SSAY8pcWjyeQ3zF7SwAD+vk6xzSn+u XBHfEuBGpl98S23x7/TU0JjksgVqX3WvxHrMEdlz7mB4zqG7+tvLqh/js7h2KG+wl57O QNBsr9f9Pe4UV4tOSa7AHjs8sL+FxEcM0TkgeG7m3C3BUGoM1/3s+eGBY6fUYU8OvQQL 8rEx8DXVxl9SaEKjM9rynM7g1mhGYLpMTqFYKPlY82TV9otCv3Rj2z6vo/uKNJgnOl/u UgDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MdaMk/1Iyy1va2ursKJc0YfZFjr+JUEVjn72TOboXzI=; b=iReGeoWogCEYFPA9h3WCHrfAtwnBJzPbIDCtpSCzrf6U6nQh/ahzGaGPRWrgq/vAyI TQ6fgQ5aoDz7yVVssbluEW4MwL3ROBotI/ybS2QMFaamCgPPJUwL6VUxIjN5soRpChAT JKI8Ut8P/Ulr1bzLn0NZq+5O10eVgrcohXmZ7KdWbryEAnhlNE/7zMwRUxdR5DxNUdO7 k1Sms7+aQ07KltSxPCd0shZpRg+8wP0FMyB9LQBBIBtcKoYUozHJ5tVSpnZH6jSmpUYn AX6ExszD8AdeaQrm+w1AwoDoGR+3XfzcEyM3uhcVLDcw52T56F5XO+KmwgPtiTg2RF2V lw9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mYnysoYf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 33si13486601edr.606.2020.10.12.14.28.29; Mon, 12 Oct 2020 14:28:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mYnysoYf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731103AbgJLNiD (ORCPT + 99 others); Mon, 12 Oct 2020 09:38:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:40138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731073AbgJLNh3 (ORCPT ); Mon, 12 Oct 2020 09:37:29 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 96C03206D9; Mon, 12 Oct 2020 13:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602509842; bh=I5DhnWPwwloFttYh0tsaSkMkHjIPiTBE1C//6ZXnnvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mYnysoYf93MpRmPwApZP7FZ9N6/GqYyJnuGRtVPSCKjLHixX3KYfosTU4YTh3kB4b E9HPZfH9asnHmPuX6tooN6Nmdn0LsbE2Bzm+4uQ/IiqxkeoxynLKLvgGTi/kWS2HT+ f7q5SG57x8o5VFqqh/7N1K+aARoBc9m5qw/oBSzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas VINCENT , Jochen Friedrich , Christophe Leroy , Wolfram Sang , Sasha Levin Subject: [PATCH 4.14 22/70] i2c: cpm: Fix i2c_ram structure Date: Mon, 12 Oct 2020 15:26:38 +0200 Message-Id: <20201012132631.291501211@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012132630.201442517@linuxfoundation.org> References: <20201012132630.201442517@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicolas VINCENT [ Upstream commit a2bd970aa62f2f7f80fd0d212b1d4ccea5df4aed ] the i2c_ram structure is missing the sdmatmp field mentionned in datasheet for MPC8272 at paragraph 36.5. With this field missing, the hardware would write past the allocated memory done through cpm_muram_alloc for the i2c_ram structure and land in memory allocated for the buffers descriptors corrupting the cbd_bufaddr field. Since this field is only set during setup(), the first i2c transaction would work and the following would send data read from an arbitrary memory location. Fixes: 61045dbe9d8d ("i2c: Add support for I2C bus on Freescale CPM1/CPM2 controllers") Signed-off-by: Nicolas VINCENT Acked-by: Jochen Friedrich Acked-by: Christophe Leroy Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-cpm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index 8a8ca945561b0..7eba874a981d3 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c @@ -74,6 +74,9 @@ struct i2c_ram { char res1[4]; /* Reserved */ ushort rpbase; /* Relocation pointer */ char res2[2]; /* Reserved */ + /* The following elements are only for CPM2 */ + char res3[4]; /* Reserved */ + uint sdmatmp; /* Internal */ }; #define I2COM_START 0x80 -- 2.25.1