[PATCH] jffs2: check the validity of dstlen in jffs2_zlib_compress()

Richard Weinberger richard at nod.at
Thu Jan 28 06:22:36 EST 2021


----- Ursprüngliche Mail -----
> Von: "Joakim Tjernlund" <Joakim.Tjernlund at infinera.com>
> An: "menglong8 dong" <menglong8.dong at gmail.com>, "David Woodhouse" <dwmw2 at infradead.org>
> CC: "yang yang29" <yang.yang29 at zte.com.cn>, "stable" <stable at vger.kernel.org>, "linux-kernel"
> <linux-kernel at vger.kernel.org>, "richard" <richard at nod.at>, "linux-mtd" <linux-mtd at lists.infradead.org>
> Gesendet: Donnerstag, 28. Januar 2021 12:17:34
> Betreff: Re: [PATCH] jffs2: check the validity of dstlen in jffs2_zlib_compress()

> On Thu, 2021-01-28 at 02:55 -0800, menglong8.dong at gmail.com wrote:
>> From: Yang Yang <yang.yang29 at zte.com.cn>
>> 
>> KASAN reports a BUG when download file in jffs2 filesystem.It is
>> because when dstlen == 1, cpage_out will write array out of bounds.
>> Actually, data will not be compressed in jffs2_zlib_compress() if
>> data's length less than 4.
> 
> Ouch, data corruption will ensue. Good find!
> I think this needs to go to stable as well.

Indeed! Do you know whether this is a regression?
Seems to be like that since ever.

Thanks,
//richard



More information about the linux-mtd mailing list