mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
mtd: cfi_cmdset_0002: Fix unlocking requests crossing a chip boudary
commit0cd8116f17upstream. The "sector is in requested range" test used to determine whether sectors should be re-locked or not is done on a variable that is reset everytime we cross a chip boundary, which can lead to some blocks being re-locked while the caller expect them to be unlocked. Fix the check to make sure this cannot happen. Fixes:1648eaaa15("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2f11a0c8c2
commit
fbbde9343c
@@ -2669,7 +2669,7 @@ static int __maybe_unused cfi_ppb_unlock(struct mtd_info *mtd, loff_t ofs,
|
||||
* sectors shall be unlocked, so lets keep their locking
|
||||
* status at "unlocked" (locked=0) for the final re-locking.
|
||||
*/
|
||||
if ((adr < ofs) || (adr >= (ofs + len))) {
|
||||
if ((offset < ofs) || (offset >= (ofs + len))) {
|
||||
sect[sectors].chip = &cfi->chips[chipnum];
|
||||
sect[sectors].adr = adr;
|
||||
sect[sectors].locked = do_ppb_xxlock(
|
||||
|
||||
Reference in New Issue
Block a user