All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nbd_genl_status: null check for nla_nest_start
@ 2019-07-23 23:01 Navid Emamdoost
  2019-07-29 13:09 ` Josef Bacik
  0 siblings, 1 reply; 11+ messages in thread
From: Navid Emamdoost @ 2019-07-23 23:01 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, secalert, Navid Emamdoost, Josef Bacik,
	Jens Axboe, linux-block, nbd, linux-kernel

nla_nest_start may fail and return NULL. The check is inserted, and
errno is selected based on other call sites within the same source code.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/block/nbd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 9bcde2325893..dba362de4d91 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -2149,6 +2149,12 @@ static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info)
 	}
 
 	dev_list = nla_nest_start_noflag(reply, NBD_ATTR_DEVICE_LIST);
+
+	if (!dev_list) {
+		ret = -EMSGSIZE;
+		goto out;
+	}
+
 	if (index == -1) {
 		ret = idr_for_each(&nbd_index_idr, &status_cb, reply);
 		if (ret) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-04-14  3:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 23:01 [PATCH] nbd_genl_status: null check for nla_nest_start Navid Emamdoost
2019-07-29 13:09 ` Josef Bacik
2019-07-29 16:42   ` [PATCH v2] " Navid Emamdoost
2019-07-30  5:52     ` [engineering.redhat.com #494735] Re: [PATCH] " Red Hat Product Security
2019-07-30  6:05     ` [PATCH v2] " Bob Liu
2019-09-10 11:35     ` Michal Kubecek
2019-09-11 16:40       ` [PATCH v3] " Navid Emamdoost
2019-10-21  6:42         ` Michal Kubecek
2021-04-14  3:05           ` Mark-PK Tsai
2019-10-17  2:17       ` [PATCH v2] " Navid Emamdoost
2019-10-17 19:37         ` [engineering.redhat.com #498403] " Red Hat Product Security

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.