netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, Wanlong Gao <gaowanlong@cn.fujitsu.com>,
	Gao feng <gaofeng@cn.fujitsu.com>
Subject: [PATCH] netconsole: enable netconsole can make net_device refcnt
Date: Tue, 11 Oct 2011 15:50:38 +0800	[thread overview]
Message-ID: <1318319438-7159-1-git-send-email-gaowanlong@cn.fujitsu.com> (raw)
In-Reply-To: <4E93E238.7000105@cn.fujitsu.com>

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(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index ed2a397..4e6323df 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 */
 
-- 
1.7.7.rc1

  reply	other threads:[~2011-10-11  7:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11  6:29 [PATCH] netconsole: enable netconsole can make net_device refcnt incorrent Gao feng
2011-10-11  7:50 ` Wanlong Gao [this message]
2011-10-11  8:05   ` [PATCH] netconsole: enable netconsole can make net_device refcnt Gao feng
2011-10-12  1:11     ` Flavio Leitner
2011-10-12  1:45       ` Gao feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318319438-7159-1-git-send-email-gaowanlong@cn.fujitsu.com \
    --to=gaowanlong@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=gaofeng@cn.fujitsu.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).