From: Gao feng Date: Tue, 11 Oct 2011 16:08:11 +0000 (+0000) Subject: netconsole: enable netconsole can make net_device refcnt incorrent X-Git-Tag: v3.0.9~122 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=18743353b3154f0ff7c29f3c5ae3a8466a70d73a;p=karo-tx-linux.git netconsole: enable netconsole can make net_device refcnt incorrent [ Upstream commit d5123480b1d6f7d1a5fe1a13520cef88fb5d4c84 ] 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 Acked-by: Flavio Leitner Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index dfc82720065a..4840ab7e7f8a 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 */