summaryrefslogtreecommitdiff
path: root/drivers/mtd/chips
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@infinera.com>2018-06-06 12:13:30 +0200
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-06-22 10:29:16 +0200
commitf1ce87f6080b1dda7e7b1eda3da332add19d87b9 (patch)
treeaf709314e6f9270ba63b01aebf49673822ac413a /drivers/mtd/chips
parent0cd8116f172eed018907303dbff5c112690eeb91 (diff)
mtd: cfi_cmdset_0002: Avoid walking all chips when unlocking.
cfi_ppb_unlock() walks all flash chips when unlocking sectors, avoid walking chips unaffected by the unlock operation. Fixes: 1648eaaa1575 ("mtd: cfi_cmdset_0002: Support Persistent Protection Bits (PPB) locking") Cc: stable@vger.kernel.org Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 9cfc2645dd93..1b64ac8c5bc8 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -2676,6 +2676,8 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs,
i++;
if (adr >> cfi->chipshift) {
+ if (offset >= (ofs + len))
+ break;
adr = 0;
chipnum++;