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 39D95390C84; Thu, 30 Jul 2026 16:16:05 +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=1785428185; cv=none; b=HE5TRrSAFlgb/sEFS/VtObWfCI808fiV3f9L3eGHq1wFodH97TSWYRbZklI90nGZ7BykiE2+EzKxhYe5CIBSqYFtb/hGz9JIWLCZiM/4Dm/XErmYMLEo/HcCO1HDobwZmmhKms7yUQSOEneQljhe8CfTmwkSN9M0UYkh001vtIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785428185; c=relaxed/simple; bh=/23u3ePRgSFeDgK2uCZj53pCxYww91TxWiAgE0ZFwAg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qy4M5t21WazgrG46al46aCNzVbOyCQzVUSbYEOF0hwYLe9dmkewYsnjwRJ4IEwLX8yhXfdgJtKkYkcZZZFrXX/PKOznzztWVh0RyCT6DxuP0tuHd9ThVmlMkDpPcgDx/6Bl+jJqAfD/nWZDzkatTOWz4PdGrom486idUlYIhIkg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H7CCRyMw; 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="H7CCRyMw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81FB91F00A3D; Thu, 30 Jul 2026 16:16:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785428165; bh=9oKR2cvV39jl63/xrNkY3g1mjkIbgujHTvl4O6Rg38w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H7CCRyMwR1Ap94CO9Fr0Q9+fszJgHiM4u70LF9k71JIfrQBG46W+6xPm5bLEB/Vy6 3erkdZbu1aei/zOVMMuSnVWMD5IE04IcoaUIECPERRWDF1Wlje/nW+yv6Z+0xBsbbr IzFpu52kIrdtl6HuuRXnMK63euNVzVFHYxvfLZl4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Miquel Raynal , Sasha Levin Subject: [PATCH 6.6 427/484] mtd: rawnand: Ensure all continuous terms are always in sync Date: Thu, 30 Jul 2026 16:15:24 +0200 Message-ID: <20260730141432.757597679@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141423.392222816@linuxfoundation.org> References: <20260730141423.392222816@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: Miquel Raynal [ Upstream commit 6fb075fca63c3486612986eeff84ed4179644038 ] While crossing a LUN boundary, it is probably safer (and clearer) to keep all members of the continuous read structure aligned, including the pause page (which is the last page of the lun or the last page of the continuous read). Once these members properly in sync, we can use the rawnand_cap_cont_reads() helper everywhere to "prepare" the next continuous read if there is one. Fixes: bbcd80f53a5e ("mtd: rawnand: Prevent crossing LUN boundaries during sequential reads") Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240223115545.354541-4-miquel.raynal@bootlin.com Stable-dep-of: 8e4531667d71 ("mtd: rawnand: Pause continuous reads at block boundaries") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/nand/raw/nand_base.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -1233,6 +1233,15 @@ static void rawnand_cap_cont_reads(struc chip->cont_read.pause_page = rawnand_last_page_of_lun(ppl, first_lun); else chip->cont_read.pause_page = chip->cont_read.last_page; + + if (chip->cont_read.first_page == chip->cont_read.pause_page) { + chip->cont_read.first_page++; + chip->cont_read.pause_page = min(chip->cont_read.last_page, + rawnand_last_page_of_lun(ppl, first_lun + 1)); + } + + if (chip->cont_read.first_page >= chip->cont_read.last_page) + chip->cont_read.ongoing = false; } static int nand_lp_exec_cont_read_page_op(struct nand_chip *chip, unsigned int page, @@ -1299,12 +1308,11 @@ static int nand_lp_exec_cont_read_page_o if (!chip->cont_read.ongoing) return 0; - if (page == chip->cont_read.pause_page && - page != chip->cont_read.last_page) { - chip->cont_read.first_page = chip->cont_read.pause_page + 1; - rawnand_cap_cont_reads(chip); - } else if (page == chip->cont_read.last_page) { + if (page == chip->cont_read.last_page) { chip->cont_read.ongoing = false; + } else if (page == chip->cont_read.pause_page) { + chip->cont_read.first_page++; + rawnand_cap_cont_reads(chip); } return 0; @@ -3512,10 +3520,7 @@ static void rawnand_cont_read_skip_first return; chip->cont_read.first_page++; - if (chip->cont_read.first_page == chip->cont_read.pause_page) - chip->cont_read.first_page++; - if (chip->cont_read.first_page >= chip->cont_read.last_page) - chip->cont_read.ongoing = false; + rawnand_cap_cont_reads(chip); } /**