USB: serial: fix memleak in driver-registration error path
authorAlexey Klimov <klimov.linux@gmail.com>
Mon, 8 Aug 2016 01:34:46 +0000 (02:34 +0100)
committerSasha Levin <alexander.levin@verizon.com>
Wed, 24 Aug 2016 18:12:37 +0000 (14:12 -0400)
commit6a19c730de76c8b870a72035416a45ea47cb8e75
tree10d091bc85ca71f1c0174f7073b11f2df6a40a56
parent61882ca3c2050d4821738454cb4966dcf8097fc5
USB: serial: fix memleak in driver-registration error path

[ Upstream commit 647024a7df36014bbc4479d92d88e6b77c0afcf6 ]

udriver struct allocated by kzalloc() will not be freed
if usb_register() and next calls fail. This patch fixes this
by adding one more step with kfree(udriver) in error path.

Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
drivers/usb/serial/usb-serial.c