lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1434875973.4987.1.camel@ingics.com>
Date:	Sun, 21 Jun 2015 16:39:33 +0800
From:	Axel Lin <axel.lin@...ics.com>
To:	Jens Axboe <axboe@...nel.dk>
Cc:	Ming Lei <ming.lei@...onical.com>, Christoph Hellwig <hch@....de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH] block: blk-flush: Check return value of bio_alloc()

bio_alloc() can return NULL, so add NULL test to prevent NULL pointer
dereference.

Signed-off-by: Axel Lin <axel.lin@...ics.com>
---
 block/blk-flush.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/blk-flush.c b/block/blk-flush.c
index 20badd7..4706641 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -470,6 +470,9 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
 		return -ENXIO;
 
 	bio = bio_alloc(gfp_mask, 0);
+	if (!bio)
+		return -ENOMEM;
+
 	bio->bi_bdev = bdev;
 
 	ret = submit_bio_wait(WRITE_FLUSH, bio);
-- 
2.1.0



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ