From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:48098 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751113AbcDJBCy (ORCPT ); Sat, 9 Apr 2016 21:02:54 -0400 Subject: Patch "bcache: fix cache_set_flush() NULL pointer dereference on OOM" has been added to the 4.4-stable tree To: git@linux.ewheeler.net, bcache@linux.ewheeler.net, gregkh@linuxfoundation.org Cc: , From: Date: Sat, 09 Apr 2016 18:02:52 -0700 Message-ID: <14602501729297@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: 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 know about it. >>From f8b11260a445169989d01df75d35af0f56178f95 Mon Sep 17 00:00:00 2001 From: Eric Wheeler Date: Mon, 7 Mar 2016 15:17:50 -0800 Subject: bcache: fix cache_set_flush() NULL pointer dereference on OOM From: Eric Wheeler 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. Signed-off-by: Eric Wheeler Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/super.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -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 git@linux.ewheeler.net 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