Patchwork netconsole: enable netconsole can make net_device refcnt incorrent

login
register
mail settings
Submitter Gao feng
Date Oct. 11, 2011, 6:29 a.m.
Message ID <4E93E238.7000105@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/118862/
State Superseded
Delegated to: David Miller
Headers show

Comments

Gao feng - Oct. 11, 2011, 6:29 a.m.
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 |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index ed2a397..4e6323d 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -307,6 +307,8 @@  static ssize_t store_enabled(struct 
netconsole_target *nt,
                 return err;
         if (enabled < 0 || enabled > 1)
                 return -EINVAL;
+       if (enabled == nt->enabled)
+               return err;

         if (enabled) {  /* 1 */