Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Gao feng and committed by
David S. Miller
d5123480 6230c9b4

+5
+5
drivers/net/netconsole.c
··· 307 307 return err; 308 308 if (enabled < 0 || enabled > 1) 309 309 return -EINVAL; 310 + if (enabled == nt->enabled) { 311 + printk(KERN_INFO "netconsole: network logging has already %s\n", 312 + nt->enabled ? "started" : "stopped"); 313 + return -EINVAL; 314 + } 310 315 311 316 if (enabled) { /* 1 */ 312 317