Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1163093 > unrolled thread

Re: isdn: pcbit: another off-by-one issue?

Started byRasmus Villemoes <linux@rasmusvillemoes.dk>
First post2015-06-11 11:30 +0200
Last post2015-06-11 11:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: isdn: pcbit: another off-by-one issue? Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-06-11 11:30 +0200

#1163093 — Re: isdn: pcbit: another off-by-one issue?

FromRasmus Villemoes <linux@rasmusvillemoes.dk>
Date2015-06-11 11:30 +0200
SubjectRe: isdn: pcbit: another off-by-one issue?
Message-ID<pA6Yb-1q8-19@gated-at.bofh.it>
[adding some emails I should Cc'ed in the first place]

On Thu, Jun 11 2015, Dan Carpenter <dan.carpenter@oracle.com> wrote:

> On Wed, Jun 10, 2015 at 09:50:53PM +0200, Rasmus Villemoes wrote:
>> Hi Dan
>> 
>> You were last to touch drivers/isdn/pcbit/drv.c (7bcc6738eef), but I
>> think there may still be an off-by-one in pcbit_set_msn: At the end of
>> the loop, sp is incremented by len, but if the string contained a comma,
>> sp will now point at that. At that point, we seem to be stuck in an
>> infinite loop where we'll always get cp==sp and len==0, until we run out
>> of memory.
>> 
>> Am I reading this completely wrong?
>
> Nope.  You're right.  That bug has been there since before the start of
> git.  We could fix it by doing:
>
> diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
> index 4172e22..b156d5b 100644
> --- a/drivers/isdn/pcbit/drv.c
> +++ b/drivers/isdn/pcbit/drv.c
> @@ -1053,7 +1053,7 @@ static void pcbit_set_msn(struct pcbit_dev *dev, char *list)
>  		else
>  			back->next = ptr;
>  		back = ptr;
> -		sp += len;
> +		sp += len + 1;
>  	} while (cp);
>  }

Yep, that's also what I would do. 

Since nobody seems to have been hit by this ever, I wonder whether it's
stable@ material. It probably doesn't make sense to fix this without
also backporting 7bcc6738eef.

Rasmus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web