提交 d5123480 编写于 作者: G Gao feng 提交者: David S. Miller

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: NGao feng <gaofeng@cn.fujitsu.com>
Acked-by: NFlavio Leitner <fbl@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6230c9b4
...@@ -307,6 +307,11 @@ static ssize_t store_enabled(struct netconsole_target *nt, ...@@ -307,6 +307,11 @@ static ssize_t store_enabled(struct netconsole_target *nt,
return err; return err;
if (enabled < 0 || enabled > 1) if (enabled < 0 || enabled > 1)
return -EINVAL; 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 */ if (enabled) { /* 1 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册