]> git.dujemihanovic.xyz Git - u-boot.git/commit
f_rockusb: Avoid use-after-free in the global pointer variable
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 3 Dec 2020 15:32:04 +0000 (17:32 +0200)
committerMarek Vasut <marex@denx.de>
Sun, 31 Jan 2021 13:08:56 +0000 (14:08 +0100)
commitff52577c1b5188a5f25bd7d7d41730bb5de4b688
treecfe5c0a83df3f556b5daf67909e44512fd667eca
parent0234609d9631652e2faf77e23f332be29570d7d2
f_rockusb: Avoid use-after-free in the global pointer variable

In case of usb_add_function() failure the error path has two issues:
 - the potentially allocated structure isn't getting freed
 - the global pointer variable is assigned to garbage

Fix the above mentioned issues by freeing memory and assigning NULL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
drivers/usb/gadget/f_rockusb.c