OSDN Git Service

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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Sep 2016 06:32:40 +0000 (08:32 +0200)
commit697c84be4b37d85a244051beadfb6f0e0bbd54d3
treed47a9aa62ecab1c8b0a20d4eb88e126e6c7ba45c
parentc5a6d60b93315ecf7d2d446045a7295f0825e6fc
USB: serial: fix memleak in driver-registration error path

commit 647024a7df36014bbc4479d92d88e6b77c0afcf6 upstream.

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>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/usb-serial.c