| Submitter | Wanlong Gao |
|---|---|
| Date | Oct. 11, 2011, 7:50 a.m. |
| Message ID | <1318319438-7159-1-git-send-email-gaowanlong@cn.fujitsu.com> |
| Download | mbox | patch |
| Permalink | /patch/118878/ |
| State | Superseded |
| Delegated to: | David Miller |
| Headers | show |
Comments
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 */ > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
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 */
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(-)