[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210506150655.GD1955@kadam>
Date: Thu, 6 May 2021 18:06:55 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: Uladzislau Rezki <urezki@...il.com>,
USB list <linux-usb@...r.kernel.org>,
Linux Media Mailing List <linux-media@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
syzkaller-bugs <syzkaller-bugs@...glegroups.com>
Subject: Re: [syzbot] WARNING in __vmalloc_node_range
On Thu, May 06, 2021 at 05:00:41PM +0200, 'Dmitry Vyukov' via syzkaller-bugs wrote:
> On Thu, May 6, 2021 at 4:57 PM Dan Carpenter <dan.carpenter@...cle.com> wrote:
> >
> > On Thu, May 06, 2021 at 04:22:10PM +0200, Uladzislau Rezki wrote:
> > > Seems like vmalloc() is called with zero size passed:
> > >
> > > <snip>
> > > void *__vmalloc_node_range(unsigned long size, unsigned long align,
> > > unsigned long start, unsigned long end, gfp_t gfp_mask,
> > > pgprot_t prot, unsigned long vm_flags, int node,
> > > const void *caller)
> > > {
> > > struct vm_struct *area;
> > > void *addr;
> > > unsigned long real_size = size;
> > > unsigned long real_align = align;
> > > unsigned int shift = PAGE_SHIFT;
> > >
> > > 2873 if (WARN_ON_ONCE(!size))
> > > return NULL;
> > > <snip>
> > >
> > > from the dvb_dmx_init() driver:
> > >
> > > <snip>
> > > int dvb_dmx_init(struct dvb_demux *dvbdemux)
> > > {
> > > int i;
> > > struct dmx_demux *dmx = &dvbdemux->dmx;
> > >
> > > dvbdemux->cnt_storage = NULL;
> > > dvbdemux->users = 0;
> > > 1251 dvbdemux->filter = vmalloc(array_size(sizeof(struct dvb_demux_filter),
> > > <snip> dvbdemux->filternum));
> >
> > Indeed.
> >
> > It is a mystery because array_size() should never return less than
> > sizeof(struct dvb_demux_filter). That's the whole point of the
> > array_size() function is that it returns ULONG_MAX if there is an
> > integer overflow.
>
> But it will return 0 if dvbdemux->filternum==0, right?
>
Heh... I'm an idiot. I was thinking of struct_size(). Sorry.
regards,
dan carpenter
Powered by blists - more mailing lists