From: Mike Snitzer Date: Wed, 25 Jan 2017 15:24:52 +0000 (+0100) Subject: dm rq: cope with DM device destruction while in dm_old_request_fn() X-Git-Tag: v4.14-rc1~1579^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4087a1fffe38106e10646606a27f10d40451862d;p=platform%2Fkernel%2Flinux-rpi3.git 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 Cc: stable@vger.kernel.org --- diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 9d7275f..6e702fc 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); }