diff options
author | Joakim Tjernlund <joakim.tjernlund@infinera.com> | 2018-06-06 13:13:30 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-03 12:23:10 +0300 |
commit | 5fdb3c468b515694159583d01a3154e0ffa4a81f (patch) | |
tree | 9eb839a390a04e142434eb40ff07077c24d7b626 /drivers/mtd | |
parent | b4e24c2842e15f221ac3527af781d7b8940b5cfb (diff) | |
download | linux-5fdb3c468b515694159583d01a3154e0ffa4a81f.tar.xz |
mtd: cfi_cmdset_0002: Avoid walking all chips when unlocking.
commit f1ce87f6080b1dda7e7b1eda3da332add19d87b9 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 2 |
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 6c042a2439e8..33d025e42793 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -2681,6 +2681,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++; |