[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20170523221347.GA11184@embeddedgus>
Date: Tue, 23 May 2017 17:13:47 -0500
From: "Gustavo A. R. Silva" <garsilva@...eddedor.com>
To: Josef Bacik <jbacik@...com>
Cc: linux-block@...r.kernel.org, nbd-general@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <garsilva@...eddedor.com>
Subject: [PATCH] block: fix potential null pointer dereference
Add null check before dereferencing pointer dev_list inside
function nla_nest_end() at line 1968: nla_nest_end(reply, dev_list);
Addresses-Coverity-ID: 1408827
Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>
---
drivers/block/nbd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 9a7bb2c..6006de5 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1948,6 +1948,9 @@ static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info)
}
dev_list = nla_nest_start(reply, NBD_ATTR_DEVICE_LIST);
+ if (!dev_list)
+ goto out;
+
if (index == -1) {
ret = idr_for_each(&nbd_index_idr, &status_cb, reply);
if (ret) {
--
2.5.0
Powered by blists - more mailing lists