Skip to content

Commit

Permalink
bridge: fix netconsole setup over bridge
Browse files Browse the repository at this point in the history
Commit 93d8bf9 ("bridge: cleanup netpoll code") introduced
a check in br_netpoll_enable(), but this check is incorrect for
br_netpoll_setup(). This patch moves the code after the check
into __br_netpoll_enable() and calls it in br_netpoll_setup().
For br_add_if(), the check is still needed.

Fixes: 93d8bf9 ("bridge: cleanup netpoll code")
Cc: Toshiaki Makita <[email protected]>
Cc: Stephen Hemminger <[email protected]>
Cc: David S. Miller <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Acked-by: Toshiaki Makita <[email protected]>
Tested-by: Toshiaki Makita <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
congwang1986 authored and davem330 committed Feb 7, 2014
1 parent ed98df3 commit dbe1730
Showing 1 changed file with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions net/bridge/br_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,33 @@ static void br_netpoll_cleanup(struct net_device *dev)
br_netpoll_disable(p);
}

static int __br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp)
{
struct netpoll *np;
int err;

np = kzalloc(sizeof(*p->np), gfp);
if (!np)
return -ENOMEM;

err = __netpoll_setup(np, p->dev, gfp);
if (err) {
kfree(np);
return err;
}

p->np = np;
return err;
}

int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp)
{
if (!p->br->dev->npinfo)
return 0;

return __br_netpoll_enable(p, gfp);
}

static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni,
gfp_t gfp)
{
Expand All @@ -236,7 +263,7 @@ static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni,
list_for_each_entry(p, &br->port_list, list) {
if (!p->dev)
continue;
err = br_netpoll_enable(p, gfp);
err = __br_netpoll_enable(p, gfp);
if (err)
goto fail;
}
Expand All @@ -249,28 +276,6 @@ static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni,
goto out;
}

int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp)
{
struct netpoll *np;
int err;

if (!p->br->dev->npinfo)
return 0;

np = kzalloc(sizeof(*p->np), gfp);
if (!np)
return -ENOMEM;

err = __netpoll_setup(np, p->dev, gfp);
if (err) {
kfree(np);
return err;
}

p->np = np;
return err;
}

void br_netpoll_disable(struct net_bridge_port *p)
{
struct netpoll *np = p->np;
Expand Down

0 comments on commit dbe1730

Please sign in to comment.