diff mbox

econet: unlock on -EPERM path

Message ID 20101207110138.GM10623@bicker
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter Dec. 7, 2010, 11:01 a.m. UTC
We need to do a mutex_unlock() and a put_dev() before returning.

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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jarek Poplawski Dec. 7, 2010, 10:01 p.m. UTC | #1
Dan Carpenter wrote:
> 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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jarek Poplawski Dec. 7, 2010, 10:09 p.m. UTC | #2
Jarek Poplawski wrote:
> Dan Carpenter wrote:
>> 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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 8, 2010, 6:14 p.m. UTC | #3
From: Dan Carpenter <error27@gmail.com>
Date: Tue, 7 Dec 2010 14:01:38 +0300

> We need to do a mutex_unlock() and a put_dev() before returning.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Nelson Elhage beat you to this one, so I integrates his version.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 13992e1..f180371 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -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) {