lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD-N9QVN7cepUpRu3d-xtr1L3DG90-nLS4gmkjerDZO21F_ejQ@mail.gmail.com>
Date:   Mon, 1 Nov 2021 16:55:30 +0800
From:   Dongliang Mu <mudongliangabcd@...il.com>
To:     Pavel Skripkin <paskripkin@...il.com>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Greg KH <gregkh@...uxfoundation.org>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: Need help in debugging "memory leak in em28xx_init_dev"

On Mon, Nov 1, 2021 at 3:50 PM Pavel Skripkin <paskripkin@...il.com> wrote:
>
> On 11/1/21 06:02, Dongliang Mu wrote:
> > Hi all,
> >
> > My local syzkaller instance found one bug named "memory leak in
> > em28xx_init_dev" in 5.14-rc5. Kernel configuration and PoC file are
> > attached(I don't check if the latest kernel is vulnerable, but it
> > should be). The trace from memleak is as follows:
> >
> > backtrace:
> >      [<ffffffff842cc66d>] kmalloc include/linux/slab.h:591 [inline]
> >      [<ffffffff842cc66d>] kzalloc include/linux/slab.h:721 [inline]
> >      [<ffffffff842cc66d>] em28xx_media_device_init
> > drivers/media/usb/em28xx/em28xx-cards.c:3444 [inline]
> >      [<ffffffff842cc66d>] em28xx_init_dev.isra.0+0x366/0x9bf
> > drivers/media/usb/em28xx/em28xx-cards.c:3624
> >      [<ffffffff842cd1bd>] em28xx_usb_probe.cold+0x4f7/0xf95
> > drivers/media/usb/em28xx/em28xx-cards.c:3979
> >      [<ffffffff82bf0815>] usb_probe_interface+0x185/0x350
> > drivers/usb/core/driver.c:396
> >
>
>
> Looks like missing clean up on error handling path.
>
> ->probe()
>      em28xx_init_dev()
>        em28xx_media_device_init() <- dev->media_dev allocated
>        *error somewhere in em28xx_init_dev()*
>

Hi Pavel,

you're right. In some error handling code (em28xx_audio_setup fails),
em28xx_init_dev fails to deallocated the media_dev field.

>
> And then nothing unwinds em28xx_media_device_init() call, since
> disconnect won't be called in case of failure in ->probe()
>
>
> Just build tested, but, I guess, something like this should work.
>
>
>
> With regards,
> Pavel Skripkin
>
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ