Skip to content

Commit 4087a1f

Browse files
committed
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: [email protected] Signed-off-by: Mike Snitzer <[email protected]> Cc: [email protected]
1 parent d19a55c commit 4087a1f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/md/dm-rq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,10 @@ static void dm_old_request_fn(struct request_queue *q)
779779
int srcu_idx;
780780
struct dm_table *map = dm_get_live_table(md, &srcu_idx);
781781

782+
if (unlikely(!map)) {
783+
dm_put_live_table(md, srcu_idx);
784+
return;
785+
}
782786
ti = dm_table_find_target(map, pos);
783787
dm_put_live_table(md, srcu_idx);
784788
}

0 commit comments

Comments
 (0)