dcb: unlock on error in dcbnl_ieee_get()
Subsystems (3)
PATCH 1/2 dcb: unlock on error in dcbnl_ieee_get()
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 <[email protected]>
net/dcb/dcbnl.c +8 -3
@@ -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);
From: Dan Carpenter <[email protected]>
Date: Wed, 5 Jan 2011 10:03:12 +0300
Quoted 4 lines
There is a "goto
nla_put_failure" hidden inside theNLA_PUT()macro, but we're holding thedcb_lockso we need to unlock first.Signed-off-by Dan Carpenter <[email protected]>
Applied, thanks Dan.