diff options
author | Mike Snitzer <snitzer@redhat.com> | 2017-01-25 16:24:52 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2017-02-03 16:18:43 +0100 |
commit | 4087a1fffe38106e10646606a27f10d40451862d (patch) | |
tree | bba4836d57a0ff1922c1831c62ba22b6bfd43794 /drivers/md | |
parent | dm mpath: cleanup -Wbool-operation warning in choose_pgpath() (diff) | |
download | linux-4087a1fffe38106e10646606a27f10d40451862d.tar.xz linux-4087a1fffe38106e10646606a27f10d40451862d.zip |
dm rq: cope with DM device destruction while in dm_old_request_fn()
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>
Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/md')
-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 9d7275fb541a..6e702fc69a83 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -779,6 +779,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); } |