netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] netconsole: enable netconsole can make net_device refcnt incorrent
@ 2011-10-12  2:08 Gao feng
  2011-10-12 13:23 ` Flavio Leitner
  0 siblings, 1 reply; 3+ messages in thread
From: Gao feng @ 2011-10-12  2:08 UTC (permalink / raw)
  To: netdev; +Cc: davem, eric.dumazet, fbl, Gao feng

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>
---
 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 ed2a397..e888202 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 */
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-19  3:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12  2:08 [PATCH v2] netconsole: enable netconsole can make net_device refcnt incorrent Gao feng
2011-10-12 13:23 ` Flavio Leitner
2011-10-19  3:55   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).