Re: net: atm: Spectre v1 fix introduced bug in bcb964012d1b in -stable

From: Pavel Machek
Date: Mon May 20 2019 - 12:18:12 EST


On Mon 2019-05-20 16:00:07, Greg KH wrote:
> On Mon, May 20, 2019 at 02:40:14PM +0200, Pavel Machek wrote:
> >
> > In lecd_attach, if arg is < 0, it was treated as 0. Spectre v1 fix
> > changed that. Bug does not exist in mainline AFAICT.
> >
> > Signed-off-by: Pavel Machek <pavel@xxxxxxx>
> > # for 4.19.y
> >
> > diff --git a/net/atm/lec.c b/net/atm/lec.c
> > index ad4f829193f0..ed279cd912f4 100644
> > --- a/net/atm/lec.c
> > +++ b/net/atm/lec.c
> > @@ -731,7 +731,7 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)
> > i = arg;
> > if (arg >= MAX_LEC_ITF)
> > return -EINVAL;
> > - i = array_index_nospec(arg, MAX_LEC_ITF);
> > + i = array_index_nospec(i, MAX_LEC_ITF);
> > if (!dev_lec[i]) {
> > int size;
> >
>
> Why is this only for 4.19.y? What is different in Linus's tree that
> makes this not needed there?

Mainline sanitizes "arg", 4.19 copies "arg" into "i" then sanitizes
it. Take a look, it is local to the function.
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: Digital signature