Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1224244
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 00/16] usb: gadget: amd5536udc: fix memory leaks |
| Date | 2015-09-14 17:20 +0200 |
| Message-ID | <q8DHY-1xe-3@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
This amd5536udc was a complete mess. The major problems that i could find are: 1) if udc_pci_probe() fails in any stage then it just calls the udc_pci_remove() to handle error. And udc_pci_remove() works with struct udc *dev which we get from pci_get_drvdata(pdev). But we do the pci_set_drvdata(pdev, dev) almost at the end of probe. So basically incase of error we are handling the error by dereferencing a NULL pointer. 2) udc_pci_remove() does a BUG_ON(dev->driver != NULL) and dev->driver will be set only if probe is success. So that means if probe fails then probe will call udc_pci_remove() for error handling and udc_pci_remove() will inturn halts the kernel by calling BUG(). And apart from these numerous memory leaks and not releasing of resources. Here comes a rewrite of few of the functions in an attempt to fix these. regards sudip Sudip Mukherjee (16): usb: gadget: amd5536udc: introduce free_dma_pools usb: gadget: amd5536udc: rewrite init_dma_pools usb: gadget: amd5536udc: rewrite udc_pci_probe usb: gadget: amd5536udc: use WARN_ON usb: gadget: amd5536udc: use free_dma_pools usb: gadget: amd5536udc: remove unnecessary conditions usb: gadget: amd5536udc: unmap virt_addr usb: gadget: amd5536udc: remove forward declaration of udc_probe usb: gadget: amd5536udc: remove forward declaration of udc_remote_wakeup usb: gadget: amd5536udc: remove forward declaration of udc_create_dma_chain usb: gadget: amd5536udc: remove forward declaration of udc_free_dma_chain usb: gadget: amd5536udc: remove forward declaration of udc_pci_* usb: gadget: amd5536udc: remove forward declaration of udc_basic_init usb: gadget: amd5536udc: NULL comparison usb: gadget: amd5536udc: remove multiple blank lines usb: gadget: amd5536udc: match alignment drivers/usb/gadget/udc/amd5536udc.c | 797 ++++++++++++++++++------------------ 1 file changed, 390 insertions(+), 407 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 00/16] usb: gadget: amd5536udc: fix memory leaks Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-14 17:20 +0200
Re: [PATCH 00/16] usb: gadget: amd5536udc: fix memory leaks Felipe Balbi <balbi@ti.com> - 2015-09-18 20:50 +0200
Re: [PATCH 00/16] usb: gadget: amd5536udc: fix memory leaks Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-19 06:00 +0200
Re: [PATCH 00/16] usb: gadget: amd5536udc: fix memory leaks Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-20 10:20 +0200
Re: [PATCH 00/16] usb: gadget: amd5536udc: fix memory leaks Felipe Balbi <balbi@ti.com> - 2015-09-20 18:20 +0200
Re: [PATCH 00/16] usb: gadget: amd5536udc: fix memory leaks Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-09-21 14:50 +0200
Re: [PATCH 00/16] usb: gadget: amd5536udc: fix memory leaks Felipe Balbi <balbi@ti.com> - 2015-09-21 16:50 +0200
Re: [PATCH 00/16] usb: gadget: amd5536udc: fix memory leaks Felipe Balbi <balbi@ti.com> - 2015-09-20 18:20 +0200
csiph-web