Skip to contentSkip to conversation

econet: unlock on -EPERM path

PATCH In review Dan Carpenter 3 participants 4 messages Dec 7, 2010 – Dec 8, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 econet: unlock on -EPERM path

We need to do a mutex_unlock() and a put_dev() before returning.

net/econet/af_econet.c +4 -2
index 13992e1..f180371 100644
@@ -661,8 +661,10 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg)
 	err = 0;
 	switch (cmd) {
 	case SIOCSIFADDR:
-		if (!capable(CAP_NET_ADMIN))
-			return -EPERM;
+		if (!capable(CAP_NET_ADMIN)) {
+			err = -EPERM;
+			break;
+		}
 
 		edev = dev->ec_ptr;
 		if (edev = NULL) {
#1 lore raw
Quoted 1 line · Dan Carpenter

We need to do a mutex_unlock() and a put_dev() before returning.

Good catch! Btw, isn't this put_dev() below, in case SIOCGIFADDR, superfluous?

Jarek P.

#2 lore raw
Quoted 5 lines · Jarek Poplawski
Quoted 1 line · Dan Carpenter

We need to do a mutex_unlock() and a put_dev() before returning.

Good catch! Btw, isn't this put_dev() below, in case SIOCGIFADDR, superfluous?

Hmm... put_dev() a.k.a. dev_put() ;-)

Jarek P.