From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Tue, 8 Sep 2015 14:50:17 -0700 Subject: [U-Boot] [PATCH 01/10] usb: gadget: don't leak configs when unbinding In-Reply-To: <20150908140037.0da2a061@amdc2363> References: <1441425831-3441-1-git-send-email-swarren@wwwdotorg.org> <20150908140037.0da2a061@amdc2363> Message-ID: <55EF5819.3050302@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 09/08/2015 05:00 AM, Lukasz Majewski wrote: > Hi Stephen, > >> From: Stephen Warren >> >> By the time g_dnl_unbind() is run, cdev->config has been set to NULL, >> so the free() there does nothing, and the config struct is leaked. >> Equally, struct usb_gadget contains a linked list of config structs, >> so the code should iterate over them all and free each one, rather >> than freeing one particular config struct. >> >> composite_unbind() already iterates over the list of config structs, >> and unlinks each from the linked list. Fix this loop to free() each >> struct as it's unlinked and otherwise forgotten. ... > > Acked-by: Lukasz Majewski > > Tested-by: Lukasz Majewski > Test HW: Odroid XU3 - Exynos5433. Thanks for all the tests/acks.