From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71DB5606A322 for ; Thu, 3 Dec 2026 18:32:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=J+Pn7aCR Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D109710E6ED; Thu, 3 Dec 2026 18:32:48 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0078110E6ED for ; Thu, 3 Dec 2026 18:32:41 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id DC5C340DE1; Thu, 3 Dec 2026 18:32:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1945E1F00899; Thu, 3 Dec 2026 18:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796322761; bh=azqVtBk5IE3sOsFQb1wV407aYDTE3wBo+gTwrsoNqa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=J+Pn7aCRxvD0yt8Gkqofzg07JskA6G6bfMCeLDuqPsUckdaE1SJvcT0YJYF4/tZvS U2RhbbHSU5c09VQXZ7791KLb/9msqGlea9bZUi8kPJgFe+L/+k6g3L5YaMs2Qf8b8M USEHP3SyTc0S2TtZR8h9e0A2BD8W1YUooEAF2JdlGBRR+s1gYSj2LDuEfwvqf/HikU ntAc05QJr5RjFVwEJagyAqm8pqE6G5kjhOzeWWdo+IPCNREfuJkj4H2vWyADW9HqtA Dw56FNuKO6vumF3LH9IeMMDhxwAXJ/x76mQxq3lCVyg2mULmpyH8YnjzTmrcUnR1Su 1DRcOc97VmwQA== From: Lee Jones To: lee@kernel.org, Mukesh Kumar Savaliya , Viken Dadhaniya , Andi Shyti , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , Philipp Stanner , Roja Rani Yarubandi , Akash Asthana , Wolfram Sang , linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 02/10] i2c: qcom-geni: Clear dma_buf pointer after releasing DMA buffer Date: Thu, 3 Dec 2026 18:31:06 +0000 Message-ID: <20261203183214.1939736-3-lee@kernel.org> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog In-Reply-To: <20261203183214.1939736-1-lee@kernel.org> References: <20261203183214.1939736-1-lee@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 geni_i2c_rx_msg_cleanup() and geni_i2c_tx_msg_cleanup() release gi2c->dma_buf without setting it back to NULL. If a subsequent transfer fails geni_se_{rx,tx}_dma_prep() and falls back to FIFO mode, gi2c->dma_buf retains the stale pointer from the previous transfer, causing the cleanup helper to unprepare and free the buffer a second time. Set gi2c->dma_buf to NULL after releasing it in both cleanup functions. Fixes: 357ee8841d0b ("i2c: qcom-geni: Store DMA mapping data in geni_i2c_dev struct") Closes: https://sashiko.dev/#/bug/linux-d60db3da-ca85-40ac-8a6c-62b1d80be7ac Cc: stable@vger.kernel.org Signed-off-by: Lee Jones --- drivers/i2c/busses/i2c-qcom-geni.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 926bc484ead2..6779719bbefa 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -505,6 +505,7 @@ static void geni_i2c_rx_msg_cleanup(struct geni_i2c_dev *gi2c, geni_i2c_rx_fsm_rst(gi2c); geni_se_rx_dma_unprep(&gi2c->se, gi2c->dma_addr, gi2c->xfer_len); i2c_put_dma_safe_msg_buf(gi2c->dma_buf, cur, !gi2c->err); + gi2c->dma_buf = NULL; } } @@ -517,6 +518,7 @@ static void geni_i2c_tx_msg_cleanup(struct geni_i2c_dev *gi2c, geni_i2c_tx_fsm_rst(gi2c); geni_se_tx_dma_unprep(&gi2c->se, gi2c->dma_addr, gi2c->xfer_len); i2c_put_dma_safe_msg_buf(gi2c->dma_buf, cur, !gi2c->err); + gi2c->dma_buf = NULL; } } -- 2.56.1.911.g883d8bcb20-goog