Mikulas Patocka 22aa66a3ee 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
2015-02-18 09:41:54 -05:00
..
2015-01-18 00:28:41 -05:00
2015-01-23 14:08:13 -08:00
2015-02-11 18:03:54 -08:00
2014-12-14 16:10:09 -08:00
2015-02-11 18:03:54 -08:00
2015-02-11 08:51:59 -08:00
2014-12-14 16:10:09 -08:00
2015-02-10 11:35:36 -08:00
2015-02-12 09:16:56 -08:00
2015-02-11 18:15:38 -08:00
2015-01-28 11:09:20 -07:00
2015-02-04 09:15:18 +01:00
2015-02-12 08:58:43 -08:00
2015-02-11 10:28:45 -08:00
2014-12-17 10:10:51 -08:00
2015-01-29 10:17:56 +02:00
2014-12-14 16:43:47 -08:00
2014-12-14 16:43:47 -08:00
2015-02-11 10:28:45 -08:00