public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: YueHaibing <yuehaibing@huawei.com>
To: colyli@suse.de, kent.overstreet@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org,
	YueHaibing <yuehaibing@huawei.com>
Subject: [PATCH -next] bcache: Fix potential NULL pointer dereference
Date: Wed, 30 Jan 2019 18:21:12 +0800	[thread overview]
Message-ID: <20190130102112.11228-1-yuehaibing@huawei.com> (raw)

There is a potential NULL pointer dereference in case
kzalloc() fails and returns NULL.

Fixes: bc082a55d25c ("bcache: fix inaccurate io state for detached bcache devices")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/md/bcache/request.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 1507041..a50afa4 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1094,6 +1094,8 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio)
 	 * which would call closure_get(&dc->disk.cl)
 	 */
 	ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
+	if (!ddip)
+		return;
 	ddip->d = d;
 	ddip->start_time = jiffies;
 	ddip->bi_end_io = bio->bi_end_io;
-- 
2.7.0

             reply	other threads:[~2019-01-30 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-30 10:21 YueHaibing [this message]
2019-01-30 10:58 ` [PATCH -next] bcache: Fix potential NULL pointer dereference Kent Overstreet
2019-02-01  2:36   ` YueHaibing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190130102112.11228-1-yuehaibing@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=colyli@suse.de \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox