Skip to content

Commit

Permalink
dm rq: cope with DM device destruction while in dm_old_request_fn()
Browse files Browse the repository at this point in the history
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: [email protected]
Signed-off-by: Mike Snitzer <[email protected]>
Cc: [email protected]
  • Loading branch information
snitm committed Feb 3, 2017
1 parent d19a55c commit 4087a1f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/md/dm-rq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 4087a1f

Please sign in to comment.