Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
USB: UDC core: fix double-free in usb_add_gadget_udc_release
commit 7ae2c3c upstream. The error-handling pathways in usb_add_gadget_udc_release() are messed up. Aside from the uninformative statement labels, they can deallocate the udc structure after calling put_device(), which is a double-free. This was observed by KASAN in automatic testing. This patch cleans up the routine. It preserves the requirement that when any failure occurs, we call put_device(&gadget->dev). Signed-off-by: Alan Stern <[email protected]> Reported-by: Fengguang Wu <[email protected]> Reviewed-by: Peter Chen <[email protected]> Acked-by: Felipe Balbi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
- Loading branch information