* [PATCH] netconsole: enable netconsole can make net_device refcnt incorrent
@ 2011-10-11 6:29 Gao feng
2011-10-11 7:50 ` [PATCH] netconsole: enable netconsole can make net_device refcnt Wanlong Gao
0 siblings, 1 reply; 5+ messages in thread
From: Gao feng @ 2011-10-11 6:29 UTC (permalink / raw)
To: netdev; +Cc: davem, eric.dumazet
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..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 */
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] netconsole: enable netconsole can make net_device refcnt
2011-10-11 6:29 [PATCH] netconsole: enable netconsole can make net_device refcnt incorrent Gao feng
@ 2011-10-11 7:50 ` Wanlong Gao
2011-10-11 8:05 ` Gao feng
0 siblings, 1 reply; 5+ messages in thread
From: Wanlong Gao @ 2011-10-11 7:50 UTC (permalink / raw)
To: netdev; +Cc: davem, Wanlong Gao, 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 | 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] netconsole: enable netconsole can make net_device refcnt
2011-10-11 7:50 ` [PATCH] netconsole: enable netconsole can make net_device refcnt Wanlong Gao
@ 2011-10-11 8:05 ` Gao feng
2011-10-12 1:11 ` Flavio Leitner
0 siblings, 1 reply; 5+ messages in thread
From: Gao feng @ 2011-10-11 8:05 UTC (permalink / raw)
To: Wanlong Gao; +Cc: netdev, davem
Im so sorry.
the first patch has some format err.
Please use this one.
thanks wanlong! ^V^
11.10.2011 15:50, Wanlong Gao wrote:
> 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 */
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netconsole: enable netconsole can make net_device refcnt
2011-10-11 8:05 ` Gao feng
@ 2011-10-12 1:11 ` Flavio Leitner
2011-10-12 1:45 ` Gao feng
0 siblings, 1 reply; 5+ messages in thread
From: Flavio Leitner @ 2011-10-12 1:11 UTC (permalink / raw)
To: Gao feng; +Cc: Wanlong Gao, netdev, davem
On Tue, 11 Oct 2011 16:05:48 +0800
Gao feng <gaofeng@cn.fujitsu.com> wrote:
> Im so sorry.
> the first patch has some format err.
> Please use this one.
> thanks wanlong! ^V^
>
> 11.10.2011 15:50, Wanlong Gao wrote:
> > 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;
It looks like 'err' will be 0. Maybe it is better to
return -EINVAL?
fbl
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] netconsole: enable netconsole can make net_device refcnt
2011-10-12 1:11 ` Flavio Leitner
@ 2011-10-12 1:45 ` Gao feng
0 siblings, 0 replies; 5+ messages in thread
From: Gao feng @ 2011-10-12 1:45 UTC (permalink / raw)
To: Flavio Leitner; +Cc: Wanlong Gao, netdev, davem
12.10.2011 09:11, Flavio Leitner wrote:
> On Tue, 11 Oct 2011 16:05:48 +0800
> Gao feng <gaofeng@cn.fujitsu.com> wrote:
>
>> Im so sorry.
>> the first patch has some format err.
>> Please use this one.
>> thanks wanlong! ^V^
>>
>> 11.10.2011 15:50, Wanlong Gao wrote:
>>> 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;
>
> It looks like 'err' will be 0. Maybe it is better to
> return -EINVAL?
>
> fbl
>
Yes,you are right,and I will add some printk.thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-10-12 1:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-11 6:29 [PATCH] netconsole: enable netconsole can make net_device refcnt incorrent Gao feng
2011-10-11 7:50 ` [PATCH] netconsole: enable netconsole can make net_device refcnt Wanlong Gao
2011-10-11 8:05 ` Gao feng
2011-10-12 1:11 ` Flavio Leitner
2011-10-12 1:45 ` Gao feng
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).