Skip to contentSkip to conversation

net: unlock before return

PATCH New Roel Kluin 1 participant 1 message Oct 26, 2007

Subsystems (4)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 net: unlock before return

To David Miller: this was the one you asked to send. I removed the incorrect one (net/bridge/netfilter/ebtables.c). Note the drivers/net/cris/eth_v10.c, which you may not yet have reviewed, But I checked, and there was not a similar comment above the header of the function :)

Roel

--
unlock before return fixes

---

drivers/net/cris/eth_v10.c +1 -0
index edd6828..5478549 100644
@@ -1476,6 +1476,7 @@ e100_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 			e100_set_duplex(dev, autoneg);
 			break;
 		default:
+			spin_unlock(&np->lock);
 			return -EINVAL;
 	}
 	spin_unlock(&np->lock);
net/9p/mux.c +3 -1
index f140147..c9f0805 100644
@@ -222,8 +222,10 @@ static int p9_mux_poll_start(struct p9_conn *m)
 	}
 
 	if (i >= ARRAY_SIZE(p9_mux_poll_tasks)) {
-		if (vptlast == NULL)
+		if (vptlast == NULL) {
+			mutex_unlock(&p9_mux_task_lock);
 			return -ENOMEM;
+		}
 
 		P9_DPRINTK(P9_DEBUG_MUX, "put in proc %d\n", i);
 		list_add(&m->mux_list, &vptlast->mux_list);
net/netfilter/nf_conntrack_netlink.c +1 -1
index 9be1826..cf18097 100644
@@ -1079,7 +1079,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
 						    CTA_TUPLE_MASTER,
 						    u3);
 			if (err < 0)
-				return err;
+				goto out_unlock;
 
 			master_h = __nf_conntrack_find(&master, NULL);
 			if (master_h == NULL) {
net/rose/af_rose.c +4 -2
index 509defe..859fdc0 100644
@@ -750,8 +750,10 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le
 
 	rose->neighbour = rose_get_neigh(&addr->srose_addr, &cause,
 					 &diagnostic);
-	if (!rose->neighbour)
-		return -ENETUNREACH;
+	if (!rose->neighbour) {
+		err = -ENETUNREACH;
+		goto out_release;
+	}
 
 	rose->lci = rose_new_lci(rose->neighbour);
 	if (!rose->lci) {