* [PATCH] isdnloop: fix and simplify isdnloop_init()
@ 2012-08-02 11:05 Fengguang Wu
2012-08-02 23:21 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Fengguang Wu @ 2012-08-02 11:05 UTC (permalink / raw)
To: open list:ISDN SUBSYSTEM
Cc: Dan Carpenter, Greg KH, devel@driverdev.osuosl.org, Joe Perches,
Karsten Keil, LKML
Fix a buffer overflow bug by removing the revision transform code.
[ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7
[ 22.097508] isdnloop: (loop0) virtual card added
[ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972
[ 22.174400]
[ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129
[ 22.624071] Call Trace:
[ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
[ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329
[ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1
[ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
[ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30
[ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
drivers/isdn/isdnloop/isdnloop.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
--- linux.orig/drivers/isdn/isdnloop/isdnloop.c 2012-05-24 19:03:06.748430938 +0800
+++ linux/drivers/isdn/isdnloop/isdnloop.c 2012-08-02 11:57:16.806437909 +0800
@@ -16,7 +16,7 @@
#include <linux/sched.h>
#include "isdnloop.h"
-static char *revision = "$Revision: 1.11.6.7 $";
+static char *revision = "1.11.6.7";
static char *isdnloop_id = "loop0";
MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card");
@@ -1494,16 +1494,7 @@ isdnloop_addcard(char *id1)
static int __init
isdnloop_init(void)
{
- char *p;
- char rev[10];
-
- if ((p = strchr(revision, ':'))) {
- strcpy(rev, p + 1);
- p = strchr(rev, '$');
- *p = 0;
- } else
- strcpy(rev, " ??? ");
- printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev);
+ printk(KERN_NOTICE "isdnloop-ISDN-driver Rev %s\n", revision);
if (isdnloop_id)
return (isdnloop_addcard(isdnloop_id));
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] isdnloop: fix and simplify isdnloop_init()
2012-08-02 11:05 [PATCH] isdnloop: fix and simplify isdnloop_init() Fengguang Wu
@ 2012-08-02 23:21 ` David Miller
2012-08-03 7:32 ` [PATCH v2] " Fengguang Wu
0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2012-08-02 23:21 UTC (permalink / raw)
To: fengguang.wu
Cc: netdev, dan.carpenter, gregkh, devel, joe, isdn, linux-kernel
From: Fengguang Wu <fengguang.wu@intel.com>
Date: Thu, 2 Aug 2012 19:05:43 +0800
> Fix a buffer overflow bug by removing the revision transform code.
>
> [ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7
> [ 22.097508] isdnloop: (loop0) virtual card added
> [ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972
> [ 22.174400]
> [ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129
> [ 22.624071] Call Trace:
> [ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
> [ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329
> [ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1
> [ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
> [ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30
> [ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
The reason the "$Revision ..." prefix is there is so that automated
version control tools will change the string automatically when code
is committed in CVS.
In the GIT era this revision style is obsolete.
Therefore you might as well just delete this crap altogether.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] isdnloop: fix and simplify isdnloop_init()
2012-08-02 23:21 ` David Miller
@ 2012-08-03 7:32 ` Fengguang Wu
2012-08-03 8:47 ` Karsten Keil
2012-08-03 8:51 ` David Miller
0 siblings, 2 replies; 7+ messages in thread
From: Fengguang Wu @ 2012-08-03 7:32 UTC (permalink / raw)
To: David Miller
Cc: devel, isdn, netdev, linux-kernel, gregkh, joe, dan.carpenter
On Thu, Aug 02, 2012 at 04:21:56PM -0700, David Miller wrote:
> From: Fengguang Wu <fengguang.wu@intel.com>
> Date: Thu, 2 Aug 2012 19:05:43 +0800
>
> > Fix a buffer overflow bug by removing the revision transform code.
> >
> > [ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7
> > [ 22.097508] isdnloop: (loop0) virtual card added
> > [ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972
> > [ 22.174400]
> > [ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129
> > [ 22.624071] Call Trace:
> > [ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
> > [ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329
> > [ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1
> > [ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
> > [ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30
> > [ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
> >
> > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
>
> The reason the "$Revision ..." prefix is there is so that automated
> version control tools will change the string automatically when code
> is committed in CVS.
>
> In the GIT era this revision style is obsolete.
>
> Therefore you might as well just delete this crap altogether.
OK. The below updated version will simply print the hard coded
revision number as it's unlikely to change any more.
Thanks,
Fengguang
---
isdnloop: fix and simplify isdnloop_init
Fix a buffer overflow bug by hard coding the revision number.
[ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7
[ 22.097508] isdnloop: (loop0) virtual card added
[ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972
[ 22.174400]
[ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129
[ 22.624071] Call Trace:
[ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
[ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329
[ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1
[ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
[ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30
[ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
drivers/isdn/isdnloop/isdnloop.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
--- linux.orig/drivers/isdn/isdnloop/isdnloop.c 2012-08-03 15:24:49.047544323 +0800
+++ linux/drivers/isdn/isdnloop/isdnloop.c 2012-08-03 15:27:39.503548375 +0800
@@ -16,7 +16,6 @@
#include <linux/sched.h>
#include "isdnloop.h"
-static char *revision = "$Revision: 1.11.6.7 $";
static char *isdnloop_id = "loop0";
MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card");
@@ -1494,16 +1493,7 @@ isdnloop_addcard(char *id1)
static int __init
isdnloop_init(void)
{
- char *p;
- char rev[10];
-
- if ((p = strchr(revision, ':'))) {
- strcpy(rev, p + 1);
- p = strchr(rev, '$');
- *p = 0;
- } else
- strcpy(rev, " ??? ");
- printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev);
+ printk(KERN_NOTICE "isdnloop-ISDN-driver Rev 1.11.6.7\n");
if (isdnloop_id)
return (isdnloop_addcard(isdnloop_id));
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] isdnloop: fix and simplify isdnloop_init()
2012-08-03 7:32 ` [PATCH v2] " Fengguang Wu
@ 2012-08-03 8:47 ` Karsten Keil
2012-08-03 8:51 ` David Miller
1 sibling, 0 replies; 7+ messages in thread
From: Karsten Keil @ 2012-08-03 8:47 UTC (permalink / raw)
To: Fengguang Wu
Cc: devel, isdn, netdev, linux-kernel, gregkh, joe, David Miller,
dan.carpenter
Am 03.08.2012 09:32, schrieb Fengguang Wu:
> On Thu, Aug 02, 2012 at 04:21:56PM -0700, David Miller wrote:
>> From: Fengguang Wu <fengguang.wu@intel.com>
>> Date: Thu, 2 Aug 2012 19:05:43 +0800
>>
>>> Fix a buffer overflow bug by removing the revision transform code.
>>>
>>> [ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7
>>> [ 22.097508] isdnloop: (loop0) virtual card added
>>> [ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972
>>> [ 22.174400]
>>> [ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129
>>> [ 22.624071] Call Trace:
>>> [ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
>>> [ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329
>>> [ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1
>>> [ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
>>> [ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30
>>> [ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
>>>
>>> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
>>
>> The reason the "$Revision ..." prefix is there is so that automated
>> version control tools will change the string automatically when code
>> is committed in CVS.
>>
>> In the GIT era this revision style is obsolete.
>>
>> Therefore you might as well just delete this crap altogether.
>
> OK. The below updated version will simply print the hard coded
> revision number as it's unlikely to change any more.
>
> Thanks,
> Fengguang
> ---
> isdnloop: fix and simplify isdnloop_init
>
> Fix a buffer overflow bug by hard coding the revision number.
>
> [ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7
> [ 22.097508] isdnloop: (loop0) virtual card added
> [ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972
> [ 22.174400]
> [ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129
> [ 22.624071] Call Trace:
> [ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
> [ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329
> [ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1
> [ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
> [ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30
> [ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> drivers/isdn/isdnloop/isdnloop.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> --- linux.orig/drivers/isdn/isdnloop/isdnloop.c 2012-08-03 15:24:49.047544323 +0800
> +++ linux/drivers/isdn/isdnloop/isdnloop.c 2012-08-03 15:27:39.503548375 +0800
> @@ -16,7 +16,6 @@
> #include <linux/sched.h>
> #include "isdnloop.h"
>
> -static char *revision = "$Revision: 1.11.6.7 $";
> static char *isdnloop_id = "loop0";
>
> MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card");
> @@ -1494,16 +1493,7 @@ isdnloop_addcard(char *id1)
> static int __init
> isdnloop_init(void)
> {
> - char *p;
> - char rev[10];
> -
> - if ((p = strchr(revision, ':'))) {
> - strcpy(rev, p + 1);
> - p = strchr(rev, '$');
> - *p = 0;
> - } else
> - strcpy(rev, " ??? ");
> - printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev);
> + printk(KERN_NOTICE "isdnloop-ISDN-driver Rev 1.11.6.7\n");
>
> if (isdnloop_id)
> return (isdnloop_addcard(isdnloop_id));
>
>
You could remove the revision completely, even from the printk.
Maybe use pr_notice("isdnloop-ISDN driver loaded\n");
Best Regards
Karsten
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] isdnloop: fix and simplify isdnloop_init()
2012-08-03 7:32 ` [PATCH v2] " Fengguang Wu
2012-08-03 8:47 ` Karsten Keil
@ 2012-08-03 8:51 ` David Miller
2012-08-03 9:10 ` [PATCH v3] " Fengguang Wu
1 sibling, 1 reply; 7+ messages in thread
From: David Miller @ 2012-08-03 8:51 UTC (permalink / raw)
To: fengguang.wu
Cc: netdev, dan.carpenter, gregkh, devel, joe, isdn, linux-kernel
From: Fengguang Wu <fengguang.wu@intel.com>
Date: Fri, 3 Aug 2012 15:32:40 +0800
> On Thu, Aug 02, 2012 at 04:21:56PM -0700, David Miller wrote:
>> From: Fengguang Wu <fengguang.wu@intel.com>
>> Date: Thu, 2 Aug 2012 19:05:43 +0800
>>
>> > Fix a buffer overflow bug by removing the revision transform code.
>> >
>> > [ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7
>> > [ 22.097508] isdnloop: (loop0) virtual card added
>> > [ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972
>> > [ 22.174400]
>> > [ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129
>> > [ 22.624071] Call Trace:
>> > [ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
>> > [ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329
>> > [ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1
>> > [ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
>> > [ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30
>> > [ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
>> >
>> > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
>>
>> The reason the "$Revision ..." prefix is there is so that automated
>> version control tools will change the string automatically when code
>> is committed in CVS.
>>
>> In the GIT era this revision style is obsolete.
>>
>> Therefore you might as well just delete this crap altogether.
>
> OK. The below updated version will simply print the hard coded
> revision number as it's unlikely to change any more.
This is worse, I said delete this crap altogether.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3] isdnloop: fix and simplify isdnloop_init()
2012-08-03 8:51 ` David Miller
@ 2012-08-03 9:10 ` Fengguang Wu
2012-08-03 23:53 ` David Miller
0 siblings, 1 reply; 7+ messages in thread
From: Fengguang Wu @ 2012-08-03 9:10 UTC (permalink / raw)
To: David Miller
Cc: netdev, dan.carpenter, gregkh, devel, joe, isdn, linux-kernel
Fix a buffer overflow bug by removing the revision and printk.
[ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7
[ 22.097508] isdnloop: (loop0) virtual card added
[ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972
[ 22.174400]
[ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129
[ 22.624071] Call Trace:
[ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
[ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329
[ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1
[ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
[ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30
[ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
drivers/isdn/isdnloop/isdnloop.c | 12 ------------
1 file changed, 12 deletions(-)
--- linux.orig/drivers/isdn/isdnloop/isdnloop.c 2012-08-03 16:39:08.543650310 +0800
+++ linux/drivers/isdn/isdnloop/isdnloop.c 2012-08-03 17:08:07.515691639 +0800
@@ -16,7 +16,6 @@
#include <linux/sched.h>
#include "isdnloop.h"
-static char *revision = "$Revision: 1.11.6.7 $";
static char *isdnloop_id = "loop0";
MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card");
@@ -1494,17 +1493,6 @@ isdnloop_addcard(char *id1)
static int __init
isdnloop_init(void)
{
- char *p;
- char rev[10];
-
- if ((p = strchr(revision, ':'))) {
- strcpy(rev, p + 1);
- p = strchr(rev, '$');
- *p = 0;
- } else
- strcpy(rev, " ??? ");
- printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev);
-
if (isdnloop_id)
return (isdnloop_addcard(isdnloop_id));
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] isdnloop: fix and simplify isdnloop_init()
2012-08-03 9:10 ` [PATCH v3] " Fengguang Wu
@ 2012-08-03 23:53 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2012-08-03 23:53 UTC (permalink / raw)
To: fengguang.wu
Cc: netdev, dan.carpenter, gregkh, devel, joe, isdn, linux-kernel
From: Fengguang Wu <fengguang.wu@intel.com>
Date: Fri, 3 Aug 2012 17:10:01 +0800
> Fix a buffer overflow bug by removing the revision and printk.
>
> [ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7
> [ 22.097508] isdnloop: (loop0) virtual card added
> [ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972
> [ 22.174400]
> [ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129
> [ 22.624071] Call Trace:
> [ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
> [ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329
> [ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1
> [ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56
> [ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30
> [ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-08-03 23:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-02 11:05 [PATCH] isdnloop: fix and simplify isdnloop_init() Fengguang Wu
2012-08-02 23:21 ` David Miller
2012-08-03 7:32 ` [PATCH v2] " Fengguang Wu
2012-08-03 8:47 ` Karsten Keil
2012-08-03 8:51 ` David Miller
2012-08-03 9:10 ` [PATCH v3] " Fengguang Wu
2012-08-03 23:53 ` David Miller
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).