From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 738B03B27C9; Sat, 17 Oct 2026 17:00:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256423; cv=none; b=jjMiTbsRKzAyLGWjhqJbem7deWshsAS7ngju4807vIiHZ8Sxr/+YbdIN4u01ywlHmL8BJCZLhwTVEltR7pS6Jt+BXsEapWumeRDzbLEkVpmyr4OaKYNlNOKvDhP4dSE+Qi1wY19YSJZEcTpPM13qwSmliiLwx8US86u6AjbCFI0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256423; c=relaxed/simple; bh=uTD18isdmWEeM6Wq75XhEft/mRkA3Rsey6F+MgwMuAs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=P25hjGvsYip5HSKUpq2k3O+ppt92UnpApdMEHQ5PgGET8T3svP7UxBWI2JHOO7hfNXo7KfNjRxsrhnO8oYrZz3cj9F/UrSAm0iITZ6HaL9hVFOewh4i5uptcdaoQNp6HMxBz/dVr1HAZEKFLZ6GFaBFegW1fA7kccb5YLWklRuU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IKYmP7Xo; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IKYmP7Xo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBD981F000C4; Sat, 17 Oct 2026 17:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792256422; bh=tJHPhO3kS+uZMfybSKdnqEQDNQkuhL05GNDzv2cXbHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IKYmP7Xoy1Q9nL6MdEPGXX0xMlsXF2E4BE4L9RTAjrCw5IhtO4mivYkc+02t1pf9o +x8yrZWdRoGRQJpqm2uxav99Ol8ueE2Eg2FDuQ9EK2kZB/mODdanRqtmml5qYYZS3V P3NPmSXU6X28V0eVp7BrPa/kYZ76TEIHJYH5EJCw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hongjian Dai , Andi Shyti , Sasha Levin Subject: [PATCH 6.6 0231/1674] i2c: at91: release DMA channels when probe defers Date: Sat, 17 Oct 2026 17:41:43 +0200 Message-ID: <20261017160437.067312544@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hongjian Dai [ Upstream commit c98bf3b86609a18ab16d067280257326e557c636 ] at91_twi_probe_master() can return -EPROBE_DEFER from at91_init_twi_recovery_info() after at91_twi_configure_dma() has already claimed the tx/rx DMA channels. at91_twi_probe() then returns without releasing them, and since dma_request_chan() is not devres-managed the channels leak on every deferred probe attempt. Release the channels before deferring the probe. Fixes: f7eeb1af8537 ("i2c: at91: release DMA channels on remove and probe error") Assisted-by: LLM Signed-off-by: Hongjian Dai Signed-off-by: Andi Shyti Link: https://patch.msgid.link/7D85C6CB6BF0A82E+20260929164340.41628-1-daihongjian@kylinsec.com.cn Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-at91-master.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c index bb9874c08401d..4737feedb940f 100644 --- a/drivers/i2c/busses/i2c-at91-master.c +++ b/drivers/i2c/busses/i2c-at91-master.c @@ -922,8 +922,14 @@ int at91_twi_probe_master(struct platform_device *pdev, at91_calc_twi_clock(dev); rc = at91_init_twi_recovery_info(pdev, dev); - if (rc == -EPROBE_DEFER) + if (rc == -EPROBE_DEFER) { + /* + * The DMA channels were already set up above, release them + * before deferring the probe so they are not leaked. + */ + at91_twi_dma_release(dev); return rc; + } dev->adapter.algo = &at91_twi_algorithm; dev->adapter.quirks = &at91_twi_quirks; -- 2.53.0