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: <1350557000-18825-1-git-send-email-yuanhan.liu@linux.intel.com>
Date:	Thu, 18 Oct 2012 18:43:20 +0800
From:	Yuanhan Liu <yuanhan.liu@...ux.intel.com>
To:	linux-kernel@...r.kernel.org
Cc:	fengguang.wu@...el.com, Yuanhan Liu <yuanhan.liu@...ux.intel.com>,
	Matthew Wilcox <matthew.r.wilcox@...el.com>,
	Keith Busch <keith.busch@...el.com>
Subject: [PATCH] NVMe: check the return of nvme_alloc_iod

It maybe failed due to out of memory.

Cc: Matthew Wilcox <matthew.r.wilcox@...el.com>
Cc: Keith Busch <keith.busch@...el.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@...ux.intel.com>
---
 drivers/block/nvme.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index 931769e..eb58978 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -1091,6 +1091,10 @@ static struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
 	}
 
 	iod = nvme_alloc_iod(count, length, GFP_KERNEL);
+	if (!iod) {
+		err = -ENOMEM;
+		goto put_pages;
+	}
 	sg = iod->sg;
 	sg_init_table(sg, count);
 	for (i = 0; i < count; i++) {
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ