diff options
author | Gao feng <gaofeng@cn.fujitsu.com> | 2011-10-11 16:08:11 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-18 23:55:29 -0400 |
commit | d5123480b1d6f7d1a5fe1a13520cef88fb5d4c84 (patch) | |
tree | d0037d50b26f5b0fa70640f4c459924d2417341a /drivers/net/netconsole.c | |
parent | 6230c9b4f8957c8938ee4cf2d03166d3c2dc89de (diff) | |
download | linux-d5123480b1d6f7d1a5fe1a13520cef88fb5d4c84.tar.bz2 |
netconsole: enable netconsole can make net_device refcnt incorrent
There is no check if netconsole is enabled current.
so when exec echo 1 > enabled;
the reference of net_device will increment always.
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r-- | drivers/net/netconsole.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index ed2a3977c6e7..e8882023576b 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -307,6 +307,11 @@ static ssize_t store_enabled(struct netconsole_target *nt, return err; if (enabled < 0 || enabled > 1) return -EINVAL; + if (enabled == nt->enabled) { + printk(KERN_INFO "netconsole: network logging has already %s\n", + nt->enabled ? "started" : "stopped"); + return -EINVAL; + } if (enabled) { /* 1 */ |