diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2015-02-17 19:34:00 (GMT) |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2015-02-18 14:41:54 (GMT) |
commit | 22aa66a3ee5b61e0f4a0bfeabcaa567861109ec3 (patch) | |
tree | ff93a13145102951cdc5302462175db52979ecdd /drivers/md/persistent-data | |
parent | 2bec1f4a8832e74ebbe859f176d8a9cb20dd97f4 (diff) | |
download | linux-22aa66a3ee5b61e0f4a0bfeabcaa567861109ec3.tar.xz |
dm snapshot: fix a possible invalid memory access on unload
When the snapshot target is unloaded, snapshot_dtr() waits until
pending_exceptions_count drops to zero. Then, it destroys the snapshot.
Therefore, the function that decrements pending_exceptions_count
should not touch the snapshot structure after the decrement.
pending_complete() calls free_pending_exception(), which decrements
pending_exceptions_count, and then it performs up_write(&s->lock) and it
calls retry_origin_bios() which dereferences s->origin. These two
memory accesses to the fields of the snapshot may touch the dm_snapshot
struture after it is freed.
This patch moves the call to free_pending_exception() to the end of
pending_complete(), so that the snapshot will not be destroyed while
pending_complete() is in progress.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/md/persistent-data')
0 files changed, 0 insertions, 0 deletions