mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
dm-verity: fix prefetch-vs-suspend race
commit 2de510fccbca3d1906b55f4be5f1de83fa2424ef upstream. There's a possible race condition in dm-verity - the prefetch work item may race with suspend and it is possible that prefetch continues to run while the device is suspended. Fix this by calling flush_workqueue and dm_bufio_client_reset in the postsuspend hook. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5162ecc2d9
commit
3e070367ff
@@ -823,6 +823,13 @@ static int verity_map(struct dm_target *ti, struct bio *bio)
|
|||||||
return DM_MAPIO_SUBMITTED;
|
return DM_MAPIO_SUBMITTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void verity_postsuspend(struct dm_target *ti)
|
||||||
|
{
|
||||||
|
struct dm_verity *v = ti->private;
|
||||||
|
flush_workqueue(v->verify_wq);
|
||||||
|
dm_bufio_client_reset(v->bufio);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Status: V (valid) or C (corruption found)
|
* Status: V (valid) or C (corruption found)
|
||||||
*/
|
*/
|
||||||
@@ -1542,6 +1549,7 @@ static struct target_type verity_target = {
|
|||||||
.ctr = verity_ctr,
|
.ctr = verity_ctr,
|
||||||
.dtr = verity_dtr,
|
.dtr = verity_dtr,
|
||||||
.map = verity_map,
|
.map = verity_map,
|
||||||
|
.postsuspend = verity_postsuspend,
|
||||||
.status = verity_status,
|
.status = verity_status,
|
||||||
.prepare_ioctl = verity_prepare_ioctl,
|
.prepare_ioctl = verity_prepare_ioctl,
|
||||||
.iterate_devices = verity_iterate_devices,
|
.iterate_devices = verity_iterate_devices,
|
||||||
|
|||||||
Reference in New Issue
Block a user