LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Don't potentially dereference NULL in net/dcb/dcbnl.c:dcbnl_getapp()
@ 2011-02-10 21:57 Jesper Juhl
  2011-02-13 19:21 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-02-10 21:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: netdev, Alexey Dobriyan, Dan Carpenter, Shmulik Ravid,
	John Fastabend, David S. Miller, Lucy Liu

nla_nest_start() may return NULL. If it does then we'll blow up in 
nla_nest_end() when we dereference the pointer.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 dcbnl.c |    3 +++
 1 file changed, 3 insertions(+)

  only compile tested.

diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 6b03f56..13cdc30 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -626,6 +626,9 @@ static int dcbnl_getapp(struct net_device *netdev, struct nlattr **tb,
 	dcb->cmd = DCB_CMD_GAPP;
 
 	app_nest = nla_nest_start(dcbnl_skb, DCB_ATTR_APP);
+	if (!app_nest)
+		goto out_cancel;
+
 	ret = nla_put_u8(dcbnl_skb, DCB_APP_ATTR_IDTYPE, idtype);
 	if (ret)
 		goto out_cancel;
-- 
Jesper Juhl <jj@chaosbits.net>            http://www.chaosbits.net/
Plain text mails only, please.
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html


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

* Re: [PATCH] Don't potentially dereference NULL in net/dcb/dcbnl.c:dcbnl_getapp()
  2011-02-10 21:57 [PATCH] Don't potentially dereference NULL in net/dcb/dcbnl.c:dcbnl_getapp() Jesper Juhl
@ 2011-02-13 19:21 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-02-13 19:21 UTC (permalink / raw)
  To: jj
  Cc: linux-kernel, netdev, adobriyan, error27, shmulikr,
	john.r.fastabend, lucy.liu

From: Jesper Juhl <jj@chaosbits.net>
Date: Thu, 10 Feb 2011 22:57:16 +0100 (CET)

> nla_nest_start() may return NULL. If it does then we'll blow up in 
> nla_nest_end() when we dereference the pointer.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Applied.

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

end of thread, other threads:[~2011-02-13 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 21:57 [PATCH] Don't potentially dereference NULL in net/dcb/dcbnl.c:dcbnl_getapp() Jesper Juhl
2011-02-13 19:21 ` 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).