Patch "dm btree: fix bufio buffer leaks in dm_btree_del() error path" has been added to the 3.10-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
dm btree: fix bufio buffer leaks in dm_btree_del() error path
to the 3.10-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
dm-btree-fix-bufio-buffer-leaks-in-dm_btree_del-error-path.patch
and it can be found in the queue-3.10 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
ed8b45a3679eb49069b094c0711b30833f27c734Mon Sep 17 00:00:00 2001
From: Joe Thornber <[email protected]>
Date: Thu, 10 Dec 2015 14:37:53 +0000
Subject: dm btree: fix bufio buffer leaks in dm_btree_del() error path
From: Joe Thornber <[email protected]>
commit ed8b45a3679eb49069b094c0711b30833f27c734 upstream.
If dm_btree_del()'s call to push_frame() fails, e.g. due to btree_node_validator finding invalid metadata, the dm_btree_del() error path must unlock all frames (which have active dm-bufio buffers) that were pushed onto the del_stack.
Otherwise, dm_bufio_client_destroy() will BUG_ON() because dm-bufio buffers have leaked, e.g.:
device-mapper: bufio: leaked buffer 3, hold count 1, list 0
--- drivers/md/persistent-data/dm-btree.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/md/persistent-data/dm-btree.c +15 -1
@@ -235,6 +235,16 @@ static bool is_internal_level(struct dm_return f->level < (info->levels -1 ); } +static void unlock_all_frames (struct del_stack *s) +{ +struct frame *f; + +while (unprocessed_frames (s)) { + f = s->spine + s->top--; +dm_tm_unlock (s->tm, f->b); + } +} +int dm_btree_del (struct dm_btree_info *info,dm_block_t root) {int r;
@@ -290,9 +300,13 @@ int dm_btree_del(struct dm_btree_info *i f->current_child = f->nr_children; } } - out: +if (r) { +/* cleanup all frames of del_stack */ +unlock_all_frames (s); + }kfree (s); +return r; }EXPORT_SYMBOL_GPL (dm_btree_del);
Patches currently in stable-queue which might be from [email protected] are
queue-3.10/dm-btree-fix-bufio-buffer-leaks-in-dm_btree_del-error-path.patch queue-3.10/dm-thin-metadata-fix-bug-when-taking-a-metadata-snapshot.patch