netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/2] dcb: unlock on error in dcbnl_ieee_get()
@ 2011-01-05  7:03 Dan Carpenter
  2011-01-06 19:17 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-01-05  7:03 UTC (permalink / raw)
  To: netdev; +Cc: John Fastabend, Shmulik Ravid, David S. Miller, kernel-janitors

There is a "goto nla_put_failure" hidden inside the NLA_PUT() macro, but
we're holding the dcb_lock so we need to unlock first.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index ff3c12d..8881cb5 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1264,9 +1264,14 @@ static int dcbnl_ieee_get(struct net_device *netdev, struct nlattr **tb,
 
 	spin_lock(&dcb_lock);
 	list_for_each_entry(itr, &dcb_app_list, list) {
-		if (strncmp(itr->name, netdev->name, IFNAMSIZ) == 0)
-			NLA_PUT(skb, DCB_ATTR_IEEE_APP,
-				sizeof(itr->app), &itr->app);
+		if (strncmp(itr->name, netdev->name, IFNAMSIZ) == 0) {
+			err = nla_put(skb, DCB_ATTR_IEEE_APP, sizeof(itr->app),
+					 &itr->app);
+			if (err) {
+				spin_unlock(&dcb_lock);
+				goto nla_put_failure;
+			}
+		}
 	}
 	spin_unlock(&dcb_lock);
 	nla_nest_end(skb, app);

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

* Re: [patch 1/2] dcb: unlock on error in dcbnl_ieee_get()
  2011-01-05  7:03 [patch 1/2] dcb: unlock on error in dcbnl_ieee_get() Dan Carpenter
@ 2011-01-06 19:17 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-01-06 19:17 UTC (permalink / raw)
  To: error27; +Cc: netdev, john.r.fastabend, shmulikr, kernel-janitors

From: Dan Carpenter <error27@gmail.com>
Date: Wed, 5 Jan 2011 10:03:12 +0300

> There is a "goto nla_put_failure" hidden inside the NLA_PUT() macro, but
> we're holding the dcb_lock so we need to unlock first.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied, thanks Dan.

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

end of thread, other threads:[~2011-01-06 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-05  7:03 [patch 1/2] dcb: unlock on error in dcbnl_ieee_get() Dan Carpenter
2011-01-06 19:17 ` 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).