Skip to contentSkip to conversation

netconsole: enable netconsole can make net_device refcnt incorrent

PATCH Applied Gao feng 3 participants 3 messages Oct 12, 2011 – Oct 19, 2011

Subsystems (3)
lore
Share & tools
lore

Gao feng

author
#0 lore raw

PATCH v2 1/1 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.

---
 drivers/net/netconsole.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/netconsole.c +5 -0
index ed2a397..e888202 100644
@@ -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 */
 
Signature · 1 line
1.7.1
maintainer Applied
#2 lore raw

From: Flavio Leitner <[email protected]>
Date: Wed, 12 Oct 2011 10:23:44 -0300

Quoted 7 lines
Quoted 4 lines · On Wed, 12 Oct 2011 10:08:11 +0800 Gao feng <[email protected]> wrote:

There is no check if netconsole is enabled current. so when exec echo 1 > enabled;
the reference of net_device will increment always.

Quoted 7 lines
Quoted 4 lines
---
 drivers/net/netconsole.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Looks better, thanks!

Applied, thanks everyone.