usb: cdc_acm: Do not leak URB buffers
authorRomain Izard <romain.izard.pro@gmail.com>
Thu, 20 Sep 2018 14:49:04 +0000 (16:49 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 13 Oct 2018 07:27:26 +0000 (09:27 +0200)
commitc92e73b11ed11baf38942fbbdbeb1f5adab81e94
treefa31448e354254f1704d4902fee82081a932024d
parent821c42e7d5ea3efc332ca1b466052a7c89f72a3b
usb: cdc_acm: Do not leak URB buffers

commit f2924d4b16ae138c2de6a0e73f526fb638330858 upstream.

When the ACM TTY port is disconnected, the URBs it uses must be killed, and
then the buffers must be freed. Unfortunately a previous refactor removed
the code freeing the buffers because it looked extremely similar to the
code killing the URBs.

As a result, there were many new leaks for each plug/unplug cycle of a
CDC-ACM device, that were detected by kmemleak.

Restore the missing code, and the memory leak is removed.

Fixes: ba8c931ded8d ("cdc-acm: refactor killing urbs")
Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Acked-by: Oliver Neukum <oneukum@suse.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/cdc-acm.c