diff mbox

netpoll: call dev_put() on error in netpoll_setup()

Message ID 20110611155047.GA3583@shale.localdomain
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Dan Carpenter June 11, 2011, 3:50 p.m. UTC
There is a dev_put(ndev) missing on an error path.  This was
introduced in 0c1ad04aecb "netpoll: prevent netpoll setup on slave
devices".

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
This is a static checker bug, and it's possible I've misunderstood
something.

--
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

David Miller June 12, 2011, 1:55 a.m. UTC | #1
From: Dan Carpenter <error27@gmail.com>
Date: Sat, 11 Jun 2011 18:50:47 +0300

> There is a dev_put(ndev) missing on an error path.  This was
> introduced in 0c1ad04aecb "netpoll: prevent netpoll setup on slave
> devices".
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> This is a static checker bug, and it's possible I've misunderstood
> something.

Definitely looks correct to me, applied, 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
Cong Wang June 12, 2011, 5:48 a.m. UTC | #2
On Sat, Jun 11, 2011 at 11:50 PM, Dan Carpenter <error27@gmail.com> wrote:
> There is a dev_put(ndev) missing on an error path.  This was
> introduced in 0c1ad04aecb "netpoll: prevent netpoll setup on slave
> devices".
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> This is a static checker bug, and it's possible I've misunderstood
> something.

Oops! My bad... you don't miss anything.

Thanks a lot for fixing it!
--
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/core/netpoll.c b/net/core/netpoll.c
index 42ea4b0..18d9cbd 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -795,7 +795,8 @@  int netpoll_setup(struct netpoll *np)
 	if (ndev->master) {
 		printk(KERN_ERR "%s: %s is a slave device, aborting.\n",
 		       np->name, np->dev_name);
-		return -EBUSY;
+		err = -EBUSY;
+		goto put;
 	}
 
 	if (!netif_running(ndev)) {