FAILED: patch "[PATCH] mtd: rawnand: brcmnand: Fix crash during the panic_write" failed to apply to 4.14-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkout FETCH_HEAD
git cherry-pick -x e66dd317194daae0475fe9e5577c80aa97f16cb9
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023091616-collapse-uncrown-ad3a@gregkh' --subject-prefix 'PATCH 4.14.y' HEAD^..
Possible dependencies:
e66dd317194d ("mtd: rawnand: brcmnand: Fix crash during the panic_write") 3c7c1e4594ef ("mtd: rawnand: brcmnand: Refactored code to introduce helper functions")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e66dd317194daae0475fe9e5577c80aa97f16cb9 Mon Sep 17 00:00:00 2001
From: William Zhang <[email protected]>
Date: Thu, 6 Jul 2023 11:29:07 -0700
Subject: [PATCH] mtd: rawnand: brcmnand: Fix crash during the panic_write
When executing a NAND command within the panic write path, wait for any pending command instead of calling BUG_ON to avoid crashing while already crashing.
drivers/mtd/nand/raw/brcmnand/brcmnand.c +11 -1
@@ -1608,7 +1608,17 @@ static void brcmnand_send_cmd(struct brcmnand_host *host, int cmd)dev_dbg (ctrl->dev,"send native cmd %d addr 0x%llx\n" , cmd, cmd_addr); -BUG_ON (ctrl->cmd_pending !=0 ); +/* +* If we came here through _panic_write and there is a pending +* command, try to wait for it. If it times out, rather than +* hitting BUG_ON, just return so we don't crash while crashing. +*/ +if (oops_in_progress) { +if (ctrl->cmd_pending && +bcmnand_ctrl_poll_status (ctrl,NAND_CTRL_RDY ,NAND_CTRL_RDY ,0 )) +return ; + }else +BUG_ON (ctrl->cmd_pending !=0 ); ctrl->cmd_pending = cmd; ret =bcmnand_ctrl_poll_status (ctrl,NAND_CTRL_RDY ,NAND_CTRL_RDY ,0 );
PATCH 1/1 mtd: rawnand: brcmnand: Fix crash during the panic_write
When executing a NAND command within the panic write path, wait for any pending command instead of calling BUG_ON to avoid crashing while already crashing.
--- drivers/mtd/nand/brcmnand/brcmnand.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/mtd/nand/brcmnand/brcmnand.c +11 -1
@@ -1271,7 +1271,17 @@ static void brcmnand_send_cmd(struct brcmnand_host *host, int cmd)dev_dbg (ctrl->dev,"send native cmd %d addr 0x%llx\n" , cmd, cmd_addr); -BUG_ON (ctrl->cmd_pending !=0 ); +/* +* If we came here through _panic_write and there is a pending +* command, try to wait for it. If it times out, rather than +* hitting BUG_ON, just return so we don't crash while crashing. +*/ +if (oops_in_progress) { +if (ctrl->cmd_pending && +bcmnand_ctrl_poll_status (ctrl,NAND_CTRL_RDY ,NAND_CTRL_RDY ,0 )) +return ; + }else +BUG_ON (ctrl->cmd_pending !=0 ); ctrl->cmd_pending = cmd; ret =bcmnand_ctrl_poll_status (ctrl,NAND_CTRL_RDY ,NAND_CTRL_RDY ,0 );
Signature · 1 line
2.37.3