* [Devel] [PATCH hci-8.1] dm: don't inherit bio-based table type for targets without ->map
@ 2026-10-17 9:35 Alexander Ivanov
2026-10-17 9:38 ` no-reply
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Ivanov @ 2026-10-17 9:35 UTC (permalink / raw)
To: den; +Cc: devel
A table whose single target has no devices inherits the live table's
type in dm_table_determine_type(). dm-qcow2 and dm-ploop open their
images by fd and never call dm_get_device(), so loading them over a
bio-based live table makes the table bio-based although these targets
have no ->map. The first bio then calls a NULL ->map from __map_bio():
BUG: kernel NULL pointer dereference, address: 0000000000000000
RIP: 0010:0x0
__map_bio+0x197/0x1c0 [dm_mod]
dm_split_and_process_bio+0x1ad/0x740 [dm_mod]
Inherit the live table's type only if the target has ->map, so it can
run bio-based. Otherwise keep the request-based type, so table_load()
rejects the mismatch with "can't change device type".
https://virtuozzo.atlassian.net/browse/VSTOR-150573
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
drivers/md/dm-table.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 954bbc338bce..a12b1cbe4336 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -987,8 +987,8 @@ static int dm_table_determine_type(struct dm_table *t)
int srcu_idx;
struct dm_table *live_table = dm_get_live_table(t->md, &srcu_idx);
- /* inherit live table's type */
- if (live_table)
+ /* only a bio-capable target inherits live table's type */
+ if (live_table && dm_target_bio_based(dm_table_get_target(t, 0)))
t->type = live_table->type;
dm_put_live_table(t->md, srcu_idx);
return 0;
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-17 9:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-17 9:35 [Devel] [PATCH hci-8.1] dm: don't inherit bio-based table type for targets without ->map Alexander Ivanov
2026-10-17 9:38 ` no-reply
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.