Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3485847pxk; Mon, 5 Oct 2020 10:51:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyThIMKwNakjA8tk1tqWvbw0Usai1g8HKLd5gKYsATUmnzg/5BlKlirVR/f0VIc1l7YFyvL X-Received: by 2002:a50:bb0d:: with SMTP id y13mr844107ede.317.1601920283751; Mon, 05 Oct 2020 10:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601920283; cv=none; d=google.com; s=arc-20160816; b=i3Puw2u6DtJtKm0kTQIcWkQFsMZ7CdapxoXhuuEz75IcyVl9rUC+NkToFpCMHZ+0Zk Ji1lGuSJgYcv5ks0TgjZa7JqlpMuPyx/7Z7EJTv364hK5BSfW+1HGoQWHZO0O6MgE6h/ huDjcp9IEd1PYc3O0q1rvZsfCUgs2vR5swf3tdeVQvw3D3WiTLdWb8HdfLlKNxLA1Dkr p5fc3hEu+G4qbEb/zPGzei6HfwxTTUjRubSSz5ajjxZ6kceBdNCI6Kb0e7v/Gclv8J0C TZ9xCyZnpVoLdYftUoY9CmJHj7mOl4gGA8bR7v6MHbQJpS/ktbUzJH8yCuJwoD2lxf3v YKiQ== 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=YEIkYe5Zu8fe8p2aWnzSdeesY4Mb6Xv4Xb1QN6aSp5M=; b=j2Ww9W4lhlNwrhWeU9NVPTf343qA/avilOnwu3y1tbwK2DJ7EEWe0GkzRlmvnW55Rt c7rthDVFSSQgEYJQEF3sDcVE26lEIOCXSMDXXR1ETtJ/rwGT+WAHGQp4tlv1IfAnXkrl TVHmuEgBEiT7DrXIAueC4Q61QXMzlHTof9xshdLw5+NXVZ3u0u/Bu4OEtiQuM3HxAHNq Ug3hv8ifyxd51+hgAZ4epsf7z4v/xsa1Y1Pc94qvtcm+kxBmencjEKNDqNcMxZ9sztXo EeYqRAhPmbuJ3uMGCLjAGH5Utalqe17+3Zn9yH+timnyqUJYTCi9gftCrBYsyT4EWwJ0 6pyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ztOIpu6r; 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 a19si212933ejb.263.2020.10.05.10.50.58; Mon, 05 Oct 2020 10:51:23 -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=ztOIpu6r; 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 S1727662AbgJEPdf (ORCPT + 99 others); Mon, 5 Oct 2020 11:33:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:33626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728167AbgJEPdc (ORCPT ); Mon, 5 Oct 2020 11:33:32 -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 A1567206DD; Mon, 5 Oct 2020 15:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601912012; bh=ZloqkwPXjzUgBZ9FVyqE9qmDx379fgknAj/TI3l0Fhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ztOIpu6rU99OzMshGlYxEHHwpF4u9a6kbxnbq7tjx+FUbC3lvSHccVhtnqDUq7eE2 uXH+8HWlQc0hghF6y/WcjKCG/DMLPvmFGZm9xn/mbQc1/O+TELW7iTDxG5+WLn7HES hjUfB1SQaBw1jrb82hWY7dOoZotjsSdBznk0Es6Q= 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 5.8 66/85] i2c: cpm: Fix i2c_ram structure Date: Mon, 5 Oct 2020 17:27:02 +0200 Message-Id: <20201005142117.905576200@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201005142114.732094228@linuxfoundation.org> References: <20201005142114.732094228@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 1213e1932ccb5..24d584a1c9a78 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c @@ -65,6 +65,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