From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BECD0C77B78 for ; Tue, 18 Apr 2023 12:40:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231778AbjDRMk1 (ORCPT ); Tue, 18 Apr 2023 08:40:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231820AbjDRMk0 (ORCPT ); Tue, 18 Apr 2023 08:40:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8907B13C07 for ; Tue, 18 Apr 2023 05:40:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16EE7632EC for ; Tue, 18 Apr 2023 12:40:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27727C433D2; Tue, 18 Apr 2023 12:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681821624; bh=U5HtpG+d0dVGhYPv5g+6ZximuYd5Po6rEhcReZqduq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7gFwByyOg2ti3xemgGcEtIzwwuzHYq97n/czEGlpCqg6AvqHzHx0pABIwA8OA3PO c8ZIpu/Byd7lCBGXBy20sNw69VDAJvkiJsMghRRSyGi6RGs/W5oHrGjcsVk7rygw9A W36ZN2PZLKPZ/MpMtfa37r/oZtCn3qgds5/M+DPY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexander Stein , Emanuele Ghidoli , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 41/91] i2c: imx-lpi2c: clean rx/tx buffers upon new message Date: Tue, 18 Apr 2023 14:21:45 +0200 Message-Id: <20230418120307.005599509@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230418120305.520719816@linuxfoundation.org> References: <20230418120305.520719816@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexander Stein [ Upstream commit 987dd36c0141f6ab9f0fbf14d6b2ec3342dedb2f ] When start sending a new message clear the Rx & Tx buffer pointers in order to avoid using stale pointers. Signed-off-by: Alexander Stein Tested-by: Emanuele Ghidoli Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-imx-lpi2c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 2018dbcf241e9..d45ec26d51cb9 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -462,6 +462,8 @@ static int lpi2c_imx_xfer(struct i2c_adapter *adapter, if (num == 1 && msgs[0].len == 0) goto stop; + lpi2c_imx->rx_buf = NULL; + lpi2c_imx->tx_buf = NULL; lpi2c_imx->delivered = 0; lpi2c_imx->msglen = msgs[i].len; init_completion(&lpi2c_imx->complete); -- 2.39.2