Re: memory leak in zr364xx_probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 23, 2020 at 5:26 PM syzbot
<syzbot+b4d54814b339b5c6bbd4@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    3644e2d2 mm/filemap: fix infinite loop in generic_file_buf..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=16f80eff500000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=37c889fb8b2761af
> dashboard link: https://syzkaller.appspot.com/bug?extid=b4d54814b339b5c6bbd4
> compiler:       gcc (GCC) 10.1.0-syz 20200507
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1089df07500000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1671c77f500000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+b4d54814b339b5c6bbd4@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> BUG: memory leak
> unreferenced object 0xffffc90000e71000 (size 200704):
>   comm "kworker/0:2", pid 3653, jiffies 4294942426 (age 13.820s)
>   hex dump (first 32 bytes):
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>   backtrace:
>     [<00000000110a155e>] __vmalloc_node_range+0x3a5/0x410 mm/vmalloc.c:2585
>     [<000000008a1ee970>] __vmalloc_node mm/vmalloc.c:2617 [inline]
>     [<000000008a1ee970>] vmalloc+0x49/0x50 mm/vmalloc.c:2650
>     [<00000000a6a3abfa>] zr364xx_board_init drivers/media/usb/zr364xx/zr364xx.c:1348 [inline]
>     [<00000000a6a3abfa>] zr364xx_probe+0x60b/0x833 drivers/media/usb/zr364xx/zr364xx.c:1509
>     [<0000000014a572f5>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396
>     [<00000000f30ee977>] really_probe+0x159/0x480 drivers/base/dd.c:561
>     [<00000000ddb29374>] driver_probe_device+0x84/0x100 drivers/base/dd.c:745
>     [<0000000073c89cb9>] __device_attach_driver+0xee/0x110 drivers/base/dd.c:851
>     [<000000009f56a99c>] bus_for_each_drv+0xb7/0x100 drivers/base/bus.c:431
>     [<00000000848d591a>] __device_attach+0x122/0x250 drivers/base/dd.c:919
>     [<00000000168be5bb>] bus_probe_device+0xc6/0xe0 drivers/base/bus.c:491
>     [<00000000464f40a6>] device_add+0x5be/0xc30 drivers/base/core.c:3091
>     [<000000008c75a2b5>] usb_set_configuration+0x9d9/0xb90 drivers/usb/core/message.c:2164
>     [<00000000071d14a5>] usb_generic_driver_probe+0x8c/0xc0 drivers/usb/core/generic.c:238
>     [<00000000f325b973>] usb_probe_device+0x5c/0x140 drivers/usb/core/driver.c:293
>     [<00000000f30ee977>] really_probe+0x159/0x480 drivers/base/dd.c:561
>     [<00000000ddb29374>] driver_probe_device+0x84/0x100 drivers/base/dd.c:745

If I am not mistaken the following should work and fix the issue (can
somebody in syzcaller test below patch, sorry it may be mangled?):

--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -1533,9 +1533,7 @@ static int zr364xx_probe(struct usb_interface *intf,
        return 0;

 fail:
-       v4l2_ctrl_handler_free(hdl);
-       v4l2_device_unregister(&cam->v4l2_dev);
-       kfree(cam);
+       v4l2_device_put(&cam->v4l2_dev);
        return err;
 }

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux