* [Patch] Uninitialized variable in drivers/net/wan/syncppp.c
@ 2006-08-31 23:13 Eric Sesterhenn
2006-08-31 23:45 ` Paul Fulghum
0 siblings, 1 reply; 4+ messages in thread
From: Eric Sesterhenn @ 2006-08-31 23:13 UTC (permalink / raw)
To: linux-kernel
hi,
this was spotted by coverity (id #891), when
len is equal to 4, we dont call sppp_lcp_conf_parse_options(),
to initialize rmagic.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.18-rc5/drivers/net/wan/syncppp.c.orig 2006-09-01 00:55:08.000000000 +0200
+++ linux-2.6.18-rc5/drivers/net/wan/syncppp.c 2006-09-01 00:55:45.000000000 +0200
@@ -505,14 +505,15 @@ static void sppp_lcp_input (struct sppp
skb->len, h);
break;
case LCP_CONF_REQ:
- if (len < 4) {
+ if (len <= 4) {
if (sp->pp_flags & PP_DEBUG)
printk (KERN_DEBUG"%s: invalid lcp configure request packet length: %d bytes\n",
dev->name, len);
break;
}
- if (len>4 && !sppp_lcp_conf_parse_options (sp, h, len, &rmagic))
+ if (!sppp_lcp_conf_parse_options (sp, h, len, &rmagic))
goto badreq;
+
if (rmagic == sp->lcp.magic) {
/* Local and remote magics equal -- loopback? */
if (sp->pp_loopcnt >= MAXALIVECNT*5) {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch] Uninitialized variable in drivers/net/wan/syncppp.c
2006-08-31 23:13 [Patch] Uninitialized variable in drivers/net/wan/syncppp.c Eric Sesterhenn
@ 2006-08-31 23:45 ` Paul Fulghum
2006-09-01 0:26 ` Eric Sesterhenn
0 siblings, 1 reply; 4+ messages in thread
From: Paul Fulghum @ 2006-08-31 23:45 UTC (permalink / raw)
To: Eric Sesterhenn; +Cc: linux-kernel
On Fri, 2006-09-01 at 01:13 +0200, Eric Sesterhenn wrote:
> --- linux-2.6.18-rc5/drivers/net/wan/syncppp.c.orig 2006-09-01 00:55:08.000000000 +0200
> +++ linux-2.6.18-rc5/drivers/net/wan/syncppp.c 2006-09-01 00:55:45.000000000 +0200
> @@ -505,14 +505,15 @@ static void sppp_lcp_input (struct sppp
> skb->len, h);
> break;
> case LCP_CONF_REQ:
> - if (len < 4) {
> + if (len <= 4) {
> if (sp->pp_flags & PP_DEBUG)
> printk (KERN_DEBUG"%s: invalid lcp configure request packet length: %d bytes\n",
> dev->name, len);
> break;
> }
> - if (len>4 && !sppp_lcp_conf_parse_options (sp, h, len, &rmagic))
> + if (!sppp_lcp_conf_parse_options (sp, h, len, &rmagic))
> goto badreq;
> +
> if (rmagic == sp->lcp.magic) {
> /* Local and remote magics equal -- loopback? */
> if (sp->pp_loopcnt >= MAXALIVECNT*5) {
This is not correct.
>From RFC1661:
Valid LCP configuration requests can have zero options (len == 4).
If the magic number option is not included in the LCP CFG REQ,
then the magic number should be treated as zero.
The correct fix is to initialize rmagic to zero before
the if (len>4 && !sppp_lcp_conf_parse_options()) line.
--
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch] Uninitialized variable in drivers/net/wan/syncppp.c
2006-08-31 23:45 ` Paul Fulghum
@ 2006-09-01 0:26 ` Eric Sesterhenn
2006-09-01 1:01 ` Paul Fulghum
0 siblings, 1 reply; 4+ messages in thread
From: Eric Sesterhenn @ 2006-09-01 0:26 UTC (permalink / raw)
To: Paul Fulghum; +Cc: linux-kernel
hi,
On Thu, 2006-08-31 at 18:45 -0500, Paul Fulghum wrote:
> Valid LCP configuration requests can have zero options (len == 4).
> If the magic number option is not included in the LCP CFG REQ,
> then the magic number should be treated as zero.
>
> The correct fix is to initialize rmagic to zero before
> the if (len>4 && !sppp_lcp_conf_parse_options()) line.
Thanks for clarification. Here is an updated patch, which has the advantage
of also silencing the gcc warning.
For len equal to 4, we never call sppp_lcp_conf_parse_options(),
therefore rmagic does not get initialized.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.18-rc5/drivers/net/wan/syncppp.c.orig 2006-09-01 02:16:18.000000000 +0200
+++ linux-2.6.18-rc5/drivers/net/wan/syncppp.c 2006-09-01 02:16:40.000000000 +0200
@@ -469,7 +469,7 @@ static void sppp_lcp_input (struct sppp
struct net_device *dev = sp->pp_if;
int len = skb->len;
u8 *p, opt[6];
- u32 rmagic;
+ u32 rmagic = 0;
if (!pskb_may_pull(skb, sizeof(struct lcp_header))) {
if (sp->pp_flags & PP_DEBUG)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch] Uninitialized variable in drivers/net/wan/syncppp.c
2006-09-01 0:26 ` Eric Sesterhenn
@ 2006-09-01 1:01 ` Paul Fulghum
0 siblings, 0 replies; 4+ messages in thread
From: Paul Fulghum @ 2006-09-01 1:01 UTC (permalink / raw)
To: Eric Sesterhenn; +Cc: linux-kernel
Eric Sesterhenn wrote:
> Thanks for clarification. Here is an updated patch, which has the advantage
> of also silencing the gcc warning.
>
> For len equal to 4, we never call sppp_lcp_conf_parse_options(),
> therefore rmagic does not get initialized.
>
> Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
>
> --- linux-2.6.18-rc5/drivers/net/wan/syncppp.c.orig 2006-09-01 02:16:18.000000000 +0200
> +++ linux-2.6.18-rc5/drivers/net/wan/syncppp.c 2006-09-01 02:16:40.000000000 +0200
> @@ -469,7 +469,7 @@ static void sppp_lcp_input (struct sppp
> struct net_device *dev = sp->pp_if;
> int len = skb->len;
> u8 *p, opt[6];
> - u32 rmagic;
> + u32 rmagic = 0;
>
> if (!pskb_may_pull(skb, sizeof(struct lcp_header))) {
> if (sp->pp_flags & PP_DEBUG)
Acked-by: Paul Fulghum <paulkf@microgate.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-09-01 1:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-31 23:13 [Patch] Uninitialized variable in drivers/net/wan/syncppp.c Eric Sesterhenn
2006-08-31 23:45 ` Paul Fulghum
2006-09-01 0:26 ` Eric Sesterhenn
2006-09-01 1:01 ` Paul Fulghum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox