mtd: fix race in cfi_cmdset_0001 driver
commit73b700aa0682ebfbe9be1ffd759ff457b1ae79d0
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Mon, 7 Feb 2011 16:07:11 +0000 (7 17:07 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Mar 2011 19:49:53 +0000 (23 12:49 -0700)
tree6de9456291184a67b090dff8dd76f72af675c25f
parent30b42e4aff84734185f703c6e703421d196801c3
mtd: fix race in cfi_cmdset_0001 driver

commit ecf3fde07c8dcb92a1bf3fbdfe70905d85cd00e1 upstream.

As inval_cache_and_wait_for_operation() drop and reclaim the lock
to invalidate the cache, some other thread may suspend the operation
before reaching the for(;;) loop. Therefore the loop must start with
checking the chip->state before reading status from the chip.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Michael Cashwell <mboards@prograde.net>
Acked-by: Stefan Bigler <stefan.bigler@keymile.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/mtd/chips/cfi_cmdset_0001.c