linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ncsi: fix a missing check for nla_nest_start
@ 2019-03-15  6:14 Kangjie Lu
  2019-03-16 18:44 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-15  6:14 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Samuel Mendoza-Jonas, David S. Miller, netdev, linux-kernel

nla_nest_start may fail and thus deserves a check.

The fix returns -EMSGSIZE in case it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 net/ncsi/ncsi-netlink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c
index 5d782445d2fc..bad17bba8ba7 100644
--- a/net/ncsi/ncsi-netlink.c
+++ b/net/ncsi/ncsi-netlink.c
@@ -251,6 +251,10 @@ static int ncsi_pkg_info_all_nl(struct sk_buff *skb,
 	}
 
 	attr = nla_nest_start(skb, NCSI_ATTR_PACKAGE_LIST);
+	if (!attr) {
+		rc = -EMSGSIZE;
+		goto err;
+	}
 	rc = ncsi_write_package_info(skb, ndp, package->id);
 	if (rc) {
 		nla_nest_cancel(skb, attr);
-- 
2.17.1


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

* Re: [PATCH] net: ncsi: fix a missing check for nla_nest_start
  2019-03-15  6:14 [PATCH] net: ncsi: fix a missing check for nla_nest_start Kangjie Lu
@ 2019-03-16 18:44 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-03-16 18:44 UTC (permalink / raw)
  To: kjlu; +Cc: pakki001, sam, netdev, linux-kernel

From: Kangjie Lu <kjlu@umn.edu>
Date: Fri, 15 Mar 2019 01:14:33 -0500

> nla_nest_start may fail and thus deserves a check.
> 
> The fix returns -EMSGSIZE in case it fails.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Applied.

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

end of thread, other threads:[~2019-03-16 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15  6:14 [PATCH] net: ncsi: fix a missing check for nla_nest_start Kangjie Lu
2019-03-16 18:44 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).