]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mtd: rawnand: serialize lock/unlock against other NAND operations
authorKamal Dasu <kamal.dasu@broadcom.com>
Thu, 5 Mar 2026 19:49:06 +0000 (14:49 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2026 10:08:56 +0000 (11:08 +0100)
commitf71ce0ae5aefe39dd5b2f996c0e08550d2153ad2
tree603f766e956cfe49ab6111cb45ae16f2aa39566d
parent1bfd188284065aa305fa4c683ac5a40a332b5f6b
mtd: rawnand: serialize lock/unlock against other NAND operations

[ Upstream commit bab2bc6e850a697a23b9e5f0e21bb8c187615e95 ]

nand_lock() and nand_unlock() call into chip->ops.lock_area/unlock_area
without holding the NAND device lock. On controllers that implement
SET_FEATURES via multiple low-level PIO commands, these can race with
concurrent UBI/UBIFS background erase/write operations that hold the
device lock, resulting in cmd_pending conflicts on the NAND controller.

Add nand_get_device()/nand_release_device() around the lock/unlock
operations to serialize them against all other NAND controller access.

Fixes: 92270086b7e5 ("mtd: rawnand: Add support for manufacturer specific lock/unlock operation")
Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com>
Reviewed-by: William Zhang <william.zhang@broadcom.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mtd/nand/raw/nand_base.c