Skip to contentSkip to conversation

Patch "bcache: fix cache_set_flush() NULL pointer dereference on OOM" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Apr 10, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

bcache: fix cache_set_flush() NULL pointer dereference on OOM

to the 4.4-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:
bcache-fix-cache_set_flush-null-pointer-dereference-on-oom.patch
and it can be found in the queue-4.4 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 f8b11260a445169989d01df75d35af0f56178f95 Mon Sep 17 00:00:00 2001

From: Eric Wheeler <[email protected]>
Date: Mon, 7 Mar 2016 15:17:50 -0800
Subject: bcache: fix cache_set_flush() NULL pointer dereference on OOM

From: Eric Wheeler <[email protected]>

commit f8b11260a445169989d01df75d35af0f56178f95 upstream.

When bch_cache_set_alloc() fails to kzalloc the cache_set, the asyncronous closure handling tries to dereference a cache_set that hadn't yet been allocated inside of cache_set_flush() which is called by __cache_set_unregister() during cleanup. This appears to happen only during an OOM condition on bcache_register.

---
 drivers/md/bcache/super.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/md/bcache/super.c +3 -0
@@ -1373,6 +1373,9 @@ static void cache_set_flush(struct closu
 	struct btree *b;
 	unsigned i;
 
+	if (!c)
+		closure_return(cl);
+
 	bch_cache_accounting_destroy(&c->accounting);
 
 	kobject_put(&c->internal);

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/bcache-cleaned-up-error-handling-around-register_cache.patch queue-4.4/bcache-fix-race-of-writeback-thread-starting-before-complete-initialization.patch queue-4.4/bcache-fix-cache_set_flush-null-pointer-dereference-on-oom.patch