diff options
author | Mike Snitzer <snitzer@redhat.com> | 2017-01-25 16:24:52 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-14 15:25:32 -0800 |
commit | 621d101a7ebb7965ee3332e4e6e8d17bdd8f0555 (patch) | |
tree | a03a1f83f0ac759b40de3e554a292ffa5379e560 /drivers | |
parent | cd755677d9444d718ac04a693523c9ff5a7f79ec (diff) |
dm rq: cope with DM device destruction while in dm_old_request_fn()
commit 4087a1fffe38106e10646606a27f10d40451862d upstream.
Fixes a crash in dm_table_find_target() due to a NULL struct dm_table
being passed from dm_old_request_fn() that races with DM device
destruction.
Reported-by: artem@flashgrid.io
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-rq.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 31a89c8832c0..2c965424d383 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -804,6 +804,10 @@ static void dm_old_request_fn(struct request_queue *q) int srcu_idx; struct dm_table *map = dm_get_live_table(md, &srcu_idx); + if (unlikely(!map)) { + dm_put_live_table(md, srcu_idx); + return; + } ti = dm_table_find_target(map, pos); dm_put_live_table(md, srcu_idx); } |