Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp838320imj; Fri, 15 Feb 2019 07:38:30 -0800 (PST) X-Google-Smtp-Source: AHgI3IbZjzrzv2wcXtresZ+jisJuZJa882OB3BTBPrksV8ngaWxvjGCBW2ggQEMuPZ6FjHRXSk4Y X-Received: by 2002:a17:902:c23:: with SMTP id 32mr10974900pls.183.1550245110493; Fri, 15 Feb 2019 07:38:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550245110; cv=none; d=google.com; s=arc-20160816; b=uB3S2tNudFUPlXnkUEO4/fY3xh7rj7uUK6QF/R7jCr1uKrcUO5Xxunsa2xDQcgN+72 FQsgVhw1D9vH8Cf/FkzxQHqFCX31OivbkJwz3JHJdj+a7FHHJtG/VsjXAEbg1CcdHa/3 TgryaR3mOj3L0jAwVG9hNAwHi1GwMqGwIDUqpMTzuoq4bezUgUHNH8EcgYbVsJtar5t9 gsqFxew7qFI0ca4cwpKirb3zexJgzS0KWPszHj6gdrziaPJhQXtlzLlEeaZPFLFCO8kD udWuVAoPM8FOxdo7OEc+GZMFVPp7KM/1xyIirk5JyoTo1DK5s7/EaTPPw0jUqTcYrRxM Lq9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7dnKUYK18DZaqMyBULnXGcyOensyoGm7UcaDCDhUiBE=; b=ikA210cb4FGwYoeb+Hvjl5Am9DspNqAs+IA+aKL4md9fK+Twij5U3BQoCIelVvMXc9 RW+K0TKkX0kelc2kTWscDGusunOeu+9+KEYnMt9G4k8yWevFsUxcvK0YNuu8c8Je/6EU RWs7VzJlXQCdW4gyMe+PCu+lLMP9QhEkN5n7jSHt8Yc20R30gW/3GsVGYQUM87ems+gz tg/QuVyTxafXys71A5F4IB5+2oabmOK3aPZQ9WsucATG/J8btJAG3jL9pwZB5JEffse1 HUEQWsJU8fG6pDAX8pSC2GhetbKCpwuq6VGnSgVFhWICSos752Qzy17lHwc3jE8wtR+7 1gaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e28si285542pgm.368.2019.02.15.07.38.14; Fri, 15 Feb 2019 07:38:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389020AbfBOIre (ORCPT + 99 others); Fri, 15 Feb 2019 03:47:34 -0500 Received: from sauhun.de ([88.99.104.3]:60138 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728761AbfBOIre (ORCPT ); Fri, 15 Feb 2019 03:47:34 -0500 Received: from localhost (unknown [83.221.228.209]) by pokefinder.org (Postfix) with ESMTPSA id 3D2F22E3551; Fri, 15 Feb 2019 09:47:32 +0100 (CET) Date: Fri, 15 Feb 2019 09:47:31 +0100 From: Wolfram Sang To: Paul Kocialkowski Cc: bcm-kernel-feedback-list@broadcom.com, linux-i2c@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Florian Fainelli , Ray Jui , Scott Branden , Eric Anholt , Stefan Wahren , Maxime Ripard , Eben Upton , Thomas Petazzoni Subject: Re: [PATCH v2] i2c: bcm2835: Clear current buffer pointers and counts after a transfer Message-ID: <20190215084731.gy7khiydgyzgfsjk@ninjato> References: <20181227154225.5492-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zp4qokiwiqe3hwav" Content-Disposition: inline In-Reply-To: <20181227154225.5492-1-paul.kocialkowski@bootlin.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --zp4qokiwiqe3hwav Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 27, 2018 at 04:42:25PM +0100, Paul Kocialkowski wrote: > The driver's interrupt handler checks whether a message is currently > being handled with the curr_msg pointer. When it is NULL, the interrupt > is considered to be unexpected. Similarly, the i2c_start_transfer > routine checks for the remaining number of messages to handle in > num_msgs. >=20 > However, these values are never cleared and always keep the message and > number relevant to the latest transfer (which might be done already and > the underlying message memory might have been freed). >=20 > When an unexpected interrupt hits with the DONE bit set, the isr will > then try to access the flags field of the curr_msg structure, leading > to a fatal page fault. >=20 > The msg_buf and msg_buf_remaining fields are also never cleared at the > end of the transfer, which can lead to similar pitfalls. >=20 > Fix these issues by introducing a cleanup function and always calling > it after a transfer is finished. >=20 > Fixes: e2474541032d ("i2c: bcm2835: Fix hang for writing messages larger = than 16 bytes") > Signed-off-by: Paul Kocialkowski Applied to for-current, thanks! --zp4qokiwiqe3hwav Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlxmfKMACgkQFA3kzBSg KbZtrxAAohPOgZx5no3ThwDEyYTFd9bMJTKd+4Vz+n1rXHl2K9Ib1/rNfkPq9fiq 7HteQbVVbxw+KOLBUUjGBv6oqF7Wf7D6Im6JDEJvMINRXXvkyKODS/x+4QkPLmzl 4h+r2BkzJpR9Bd5hmWYvot8dia8sUM0qJpEGxKoxezbarIwK6gGeXBZb5hDm94R+ Qb2robryMxM5URI15D8wPFPUhnOxFhv01fRb1bVgJgcF1k2iBIFWHDU+13YGqgPX v2q6DjebSMv/riI5o/wxOuM9o77cvYA8O8OKyc2bdtLxVuoi9yHIvR0LtG/t4ylS ZODqbfhu2hk4qlqGVYaq9kYxtH0W/eiE7nTUpM8aNvqLKOrK0HVM6kCm2Tt+TBJI XpZGBUPdS9YHv5bWJEQvT2svoli0whFKa16glpK3lzl7f6e2xxG2rqfV4xiqaZSt vW+x2XO07lvZgVYBi/PyfPD+WazQZaZdxk8kWuYwO6KN8if4h8ltoqrfbbhFGQGa Bs/kFkddb5hzAXBPUdHGr+dEgKT9VrIEYRrdc1PtSeSrbOFeu+xJviH8zgnlar56 romtLgZ3AoxcColAq7JFrMa1ZiYI1torjIxfMFtoNRZZv/JxgDMPuaSwCBMywlxZ joUf0GbmiGtLW+zMeTb0B6RNTVMimxXB/XqQ0rirCkv8o0N0oP8= =JjNL -----END PGP SIGNATURE----- --zp4qokiwiqe3hwav--