Re: [PATCH v2] nvmem: brcm_nvram: don't cut NVRAM data shorter than its header length

From: Greg Kroah-Hartman

Date: Wed Dec 02 2026 - 02:37:47 EST


On Tue, Dec 01, 2026 at 08:09:43PM -0800, Rosen Penev wrote:
> On Tue, Dec 1, 2026 at 5:55 AM Srinivas Kandagatla <srini@xxxxxxxxxx> wrote:
> >
> >
> >
> > On 11/29/26 9:55 PM, Rosen Penev wrote:
> > > brcm_nvram_copy_data() sizes the data by stripping trailing bytes that
> > > equal the last byte of the region. NVRAM content itself ends with NUL
> > > bytes, so when the region is padded with 0x00 instead of erased 0xff,
> > > the loop also strips the end of the content. Since
> > > commit a67e2c323a47 ("nvmem: brcm_nvram: fix out-of-bounds access on malformed flash data")
> > > the header length is checked against that size, and such NVRAM is now
> > > rejected. On an ASUS RT-N16, whose CFE pads NVRAM with zeros:
> > >
> > > brcm_nvram 1dff8000.nvram: NVRAM length (2600) exceeds data size (2596)
> > >
> > > Extend the data to the length in the header when that fits in the
> > > mapped region. The buffer still covers every byte the parser reads,
> > > so the out-of-bounds protection is kept.
> > >
> > > Fixes: a67e2c323a47 ("nvmem: brcm_nvram: fix out-of-bounds access on malformed flash data")
> >
> > CC Stable missing.
> Is that seriously it? The bots will backport it anyway.

Maybe, maybe not. You are taking a chance we will not do it unless cc:
stable is really there.