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 951CA33291F; Thu, 28 May 2026 20:53:27 +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=1780001608; cv=none; b=H9DQslcypVkFqQSjFzvjmlb94W1h6/4pB5vdUoqkXVg8Uqz6N1kwW5p7zfZGUb1Tn7ktkOTlH2jKviCggwSr9/cuPBZBYDjhfAygeqviroNGO3lmfovtozNNnrStWfvhAu8fdbN2vWpKx8CzKV/laqqHdTvbM7ZrjtDg8PRul30= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780001608; c=relaxed/simple; bh=PDXWZgAwZKuu/+PqCWLaPIGsenq/EuT0rJz4x4M6HbE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HN9CIZJpVq0VMSyb8XBNpRTcnA24vrsI5GsoNqSQJVtByqU71zKDbFySEL8CPTiqFGJuYuQpxUBvJkUwB4qPx8NlASNvdfh+Y/fLXzLpJjqxl5YubfeFQIXtw4X3nQVgbDs896Vk6ds3rZf0aeUyoTDqAMvdmIdlQRikINiJ1H0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mTSrJxJ0; 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="mTSrJxJ0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3D0B1F000E9; Thu, 28 May 2026 20:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780001607; bh=RGfbE5umUc875GvlfBzKLQVdfFN6A/mMD3Dp9LXHy7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mTSrJxJ0OQX10pgTafwHGxhONPoVz9vityjrh24itIQNoca/nkEioHqp5GAzDdeI9 JNzehI83YoKkT48cIh04qHtHHbSrq8ifaYrq5WcALuVWRVNKY0hxkols2DEfvhoIw2 npYJdDi7+g9maLi+iTfmsYXyJ4sXDnifUeWSEJgw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Felix Gu , Mark Brown , Sasha Levin Subject: [PATCH 6.6 151/186] spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache() Date: Thu, 28 May 2026 21:50:31 +0200 Message-ID: <20260528194933.033372765@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260528194928.941004471@linuxfoundation.org> References: <20260528194928.941004471@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: Felix Gu [ Upstream commit 496ba79b9496b8b3747cbc764ebd33ee7325e806 ] When DMA read times out in mtk_snand_read_page_cache(), the original code erroneously jumped to cleanup label which skips DMA unmapping and ECC disable, causing a resource leak. Fixes: 764f1b748164 ("spi: add driver for MTK SPI NAND Flash Interface") Signed-off-by: Felix Gu Link: https://patch.msgid.link/20260510-snfi-v1-1-bc375cf1af8e@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-mtk-snfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-mtk-snfi.c b/drivers/spi/spi-mtk-snfi.c index 22f3b22d77ad8..f960c2c2f6b81 100644 --- a/drivers/spi/spi-mtk-snfi.c +++ b/drivers/spi/spi-mtk-snfi.c @@ -961,7 +961,7 @@ static int mtk_snand_read_page_cache(struct mtk_snand *snf, &snf->op_done, usecs_to_jiffies(SNFI_POLL_INTERVAL))) { dev_err(snf->dev, "DMA timed out for reading from cache.\n"); ret = -ETIMEDOUT; - goto cleanup; + goto cleanup2; } // Wait for BUS_SEC_CNTR returning expected value -- 2.53.0