Linux Device Mapper development
 help / color / mirror / Atom feed
* [PATCH] dm persistent data: assign new_root only when removal succeeds
@ 2026-11-23 20:55 Mikulas Patocka
  2026-11-23 21:15 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Mikulas Patocka @ 2026-11-23 20:55 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, Benjamin Marzinski, Ming-Hung Tsai,
	dm-devel

The commit b6e58b5466b2 ("dm btree remove: assign new_root only when
removal succeeds") fixed a crash when removal failed due to I/O error.
This commit overlooked a similar problem in remove_one. This problem is
latent because it is only reachable from __remove_range ignores new_root
on error, but it still wrong to read uninitialized memory.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Assisted-by: Claude:claude-opus-5

---
 drivers/md/persistent-data/dm-btree-remove.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/md/persistent-data/dm-btree-remove.c
===================================================================
--- linux-2.6.orig/drivers/md/persistent-data/dm-btree-remove.c
+++ linux-2.6/drivers/md/persistent-data/dm-btree-remove.c
@@ -755,7 +755,8 @@ static int remove_one(struct dm_btree_in
 		r = -ENODATA;
 
 out:
-	*new_root = shadow_root(&spine);
+	if (!r)
+		*new_root = shadow_root(&spine);
 	exit_shadow_spine(&spine);
 
 	return r;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 20:55 [PATCH] dm persistent data: assign new_root only when removal succeeds Mikulas Patocka
2026-11-23 21:15 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox