netconsole: enable netconsole can make net_device refcnt incorrent
Subsystems (3)
PATCH 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 | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/netconsole.c +2 -0
@@ -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 */
Signature · 1 line
1.7.1
PATCH 1/1 netconsole: enable netconsole can make net_device refcnt
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 | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/netconsole.c +2 -0
@@ -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 */
Signature · 1 line
1.7.7.rc1
Re: [PATCH] netconsole: enable netconsole can make net_device refcnt
Im so sorry.
the first patch has some format err.
Please use this one.
thanks wanlong! ^V^
Quoted 22 lines · Wanlong Gao
There is no check if netconsole is enabled current. so when exec echo 1 > enabled;
the reference ofnet_devicewill increment always.Signed-off-by Gao feng <[email protected]>--- drivers/net/netconsole.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/net/netconsole.c +2
-0@@ -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 */
Re: [PATCH] netconsole: enable netconsole can make net_device refcnt
Quoted 15 lines · On Tue, 11 Oct 2011 16:05:48 +0800 Gao feng <[email protected]> wrote:
Im so sorry.
the first patch has some format err.
Please use this one.
thanks wanlong! ^V^Quoted 9 lines · Wanlong Gao
There is no check if netconsole is enabled current. so when exec echo 1 > enabled;
the reference ofnet_devicewill increment always.Signed-off-by Gao feng <[email protected]>--- drivers/net/netconsole.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
Quoted 10 lines
drivers/net/netconsole.c static ssize_t store_enabled(struct · line 311
Quoted 10 lines
drivers/net/netconsole.c +2
-0@@ -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
Re: [PATCH] netconsole: enable netconsole can make net_device refcnt
Quoted 32 lines · Flavio Leitner
Quoted 15 lines · On Tue, 11 Oct 2011 16:05:48 +0800 Gao feng <[email protected]> wrote:
Im so sorry.
the first patch has some format err.
Please use this one.
thanks wanlong! ^V^Quoted 9 lines · Wanlong Gao
There is no check if netconsole is enabled current. so when exec echo 1 > enabled;
the reference ofnet_devicewill increment always.Signed-off-by Gao feng <[email protected]>--- drivers/net/netconsole.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)Quoted 10 lines
drivers/net/netconsole.c static ssize_t store_enabled(struct · line 311
Quoted 10 lines
drivers/net/netconsole.c +2
-0@@ -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?
Quoted 2 lines
fbl
Yes,you are right,and I will add some printk.thanks.