dwc2: Memory leak in dwc2_gadget_init

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

 



Hi Minas,

i noticed that in opposite to all allocations in dwc2_gadget_init() the function dwc2_hsotg_ep_alloc_request() uses kzalloc. So in case usb_add_gadget_udc() would fail, the memory of the USB request would be leaked:

Linux raspberrypi 4.16.0-rc7-next-20180327+ #2 SMP PREEMPT Sat Mar 31 13:24:47 CEST 2018 armv6l GNU/Linux

unreferenced object 0xd8703cc0 (size 64):
  comm "kworker/0:1", pid 18, jiffies 4294937977 (age 2780.490s)
  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:
    [<09023b43>] kmemleak_alloc+0x78/0xc0
    [<60182b94>] kmem_cache_alloc_trace+0x150/0x398
    [<fb48c354>] dwc2_hsotg_ep_alloc_request+0x34/0x58
    [<401a2371>] dwc2_gadget_init+0x32c/0x3ec
    [<2b1d6850>] dwc2_driver_probe+0x320/0x418
    [<765bc59d>] platform_drv_probe+0x60/0xac
    [<65e4f320>] driver_probe_device+0x2d4/0x46c
    [<57a8c266>] __device_attach_driver+0xb0/0x104
    [<14964192>] bus_for_each_drv+0x98/0xa0
    [<34c644b4>] __device_attach+0xb0/0x13c
    [<b5c37b6a>] device_initial_probe+0x1c/0x20
    [<f5172fc7>] bus_probe_device+0x38/0x94
    [<550305ed>] deferred_probe_work_func+0x12c/0x14c
    [<681db7c3>] process_one_work+0x3c8/0x76c
    [<818bc895>] process_scheduled_works+0x38/0x3c
    [<0dd47435>] worker_thread+0x2c4/0x43c

Best regards
Stefan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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

  Powered by Linux