Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5114560ima; Tue, 5 Feb 2019 06:37:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IaeeSwz36Dpl4/mOqsZrYa0I9wQGW1sn2EAt5srr/MTyMKCSVgxPCaZXOOlYBLEG5/EBuAn X-Received: by 2002:a62:f54f:: with SMTP id n76mr5338034pfh.59.1549377459222; Tue, 05 Feb 2019 06:37:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549377459; cv=none; d=google.com; s=arc-20160816; b=xVSXYbqU5tVLl3BNtwKnCrJYyylEmyOEA/m8W+F6UYaI/jSrcAe+TRWNAMqZp5jvhh UX0CzxFMW/Bq4HXN8DPF71vFd9Y8js8BTtJEcPW01hpS0ZiktgUCoWLtKyK8XSjTnfCd 2a4jim+MEvH8zsraYD6hD6dvXFZkV0i2hJ7OGboPq5EeRa//An528rL68Bzzf6X1K9WK HjLHD6DoxoL9PvlxCynL/KkJVCru9669FOFGM17+uD0fSDwGlkVMX+UgmdRv0dZgofdf NTT7fxz54FiEqiDr3mY+31AYEdEPlj4pS4sZyi3X3pVj3ZgzGjr3NmlH6UtCawsbOLG8 egNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=AB/r/risBYPoL4CuRrd5Vn90gnYmob+B5rhjlpCXwec=; b=Xh45XPwo7vrsiVy2zN+pj0u34VB5wU418uUg0STmshsVYsSvwAr41jqyLu6xhpXuuF Wz4LUq8F7mKDVLI9Jrpu9ZMtGN+gSFIu1GwrsqPgrkNLiCJvVeQYgPEhg+elURuvEMRR O6YCWQ+WDYaO/Kw8zmobIEjqwExByzUs9akhYCRzPS/HXBz3SYoFR3at3y+i0RIL5i6E yzIvYPmsoiAeg2DYEGGxWyW1RxNWIAFqx+HxbAxyKiKCy4BJxgbTCFfn0iHZSeWoGeej FPPO40gbugnofdbu7khEny5LTGqMH8+QzLRJBM5IMMeULo0wauzzW8OtbkL8jYAplJ2f C9Sw== 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 q19si3118157pgv.436.2019.02.05.06.37.23; Tue, 05 Feb 2019 06:37:39 -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 S1728103AbfBEOO4 (ORCPT + 99 others); Tue, 5 Feb 2019 09:14:56 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:34241 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726276AbfBEOOz (ORCPT ); Tue, 5 Feb 2019 09:14:55 -0500 Received: from [192.168.178.52] ([109.104.46.226]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MfHUx-1hJjTa3b4d-00gryI; Tue, 05 Feb 2019 15:14:37 +0100 Subject: Re: [PATCH v2] i2c: bcm2835: Clear current buffer pointers and counts after a transfer To: Wolfram Sang , Paul Kocialkowski Cc: Florian Fainelli , Scott Branden , Eben Upton , Maxime Ripard , Ray Jui , linux-kernel@vger.kernel.org, Eric Anholt , bcm-kernel-feedback-list@broadcom.com, linux-i2c@vger.kernel.org, Thomas Petazzoni , linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org References: <20181227154225.5492-1-paul.kocialkowski@bootlin.com> <20190205120905.GB1045@kunai> From: Stefan Wahren Message-ID: <3784fe11-bdc4-5751-13b4-f50bdeeee205@i2se.com> Date: Tue, 5 Feb 2019 15:14:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190205120905.GB1045@kunai> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Provags-ID: V03:K1:nQmOSq0Sytf9T6z48blffv0JlWaArSj5LejxShFwdHoS44WeU+p MdNeW0T1thqMZD9avGYHMeAv8COndE32Qrtg4jonqg51J2Eh08Q6KumI+TRBQ6uyU88q1xg hWqNJCPILKg1KVTrhnfqRFHX+Q+zXBkL5vgGHbX6f51sD7akSqSSt21L1wbhr2iGrzpMYIj Ard2p4+MtZL8zm6EpTIEA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:5pg5KoYkHdQ=:XtBcIpjc/dtUE+Gcxf6LuU I0PSQoTfhBUDVbpFoktoWhz0n6SrQygkMmww5bLPfI3g4S6+ucbO1D6TsB8uEt66ujSu1aTv0 IyDQK/FTEGQLomrAn+6eHeYfDTJuZ15Kfb5kOOdg7+tyBKfrAeP00jyFanUHIVh+0ZBSo6neA AWuVbc77B2c78qMt4FGFE1o/c3a9CqZWNxkTCw64GlU4J9zf5wYElqQWk2M1C/o26TwkZmuwC QNEArncSnKeKmilrvWhRQcZRqs+7URtFkoRq9ZwEWKY07ZYoefZf2fWEt1B4yjBJGz/Zv0rkx 5l+D021cLAnx3VqQKgYkT611n2ZVDg6WCN/eP1S5GFki1HPcq738VI2muf3BAi6MQG+tdtkih PnUmfhiewQjCtvRkdbooQGaKpVMsJSRxoXiunaEIscdySEe+iGYnreCP8kq4MnsiZa18W9i7A EoFB5Y+TYA2ZxHNQooOWe/OFR27Vc2poeud8bYHyWWg29e4fsswv+pzBg/X5qxeC80Ee1Zwcf MGbTX+ReKdXGWqQTHkm5VJy/CM1GyG8K8hbzjdQrp3Y4AAnTIB5CMqVIEaptDdSOuGAdwWzxf rUgaF9GLQz5Bi+b07/XmZegXCtxwWGEdeXM5O8Buy61vvBU0TthkXMe6B+LWIh75t4+2pzqt9 LF6oDj5NWSizkTr1JyoAScZ2qx+PwiQ7dnhEqAo/DEE5yJ52HD2j0zaPP6z95FSXouTFk+eyT utSDjO4wa/UOopOC+ZmRiF4Y891DwJApThgH/H+Yfg13eHDZejfsLz0FJOc= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 05.02.19 um 13:09 schrieb Wolfram Sang: > 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. >> >> 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). >> >> 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. >> >> The msg_buf and msg_buf_remaining fields are also never cleared at the >> end of the transfer, which can lead to similar pitfalls. >> >> Fix these issues by introducing a cleanup function and always calling >> it after a transfer is finished. >> >> Fixes: e2474541032d ("i2c: bcm2835: Fix hang for writing messages larger than 16 bytes") >> Signed-off-by: Paul Kocialkowski > Stefan, Florian, any comment about this patch? Acked-by: Stefan Wahren Thanks