Bluetooth: uart-ldisc: Fix memory leak
authorJohan Hovold <jhovold@gmail.com>
Wed, 11 Apr 2012 09:24:35 +0000 (11:24 +0200)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 30 Apr 2012 18:15:06 +0000 (19:15 +0100)
commit2957309534d744b5a93c6b7bd8be04d6b4b18a63
tree43cc84a2218d66257fb5833a3a573b239c0c3996
parent3f9e80c2184f2d5321639c9e283823e9e35ad89e
Bluetooth: uart-ldisc: Fix memory leak

BugLink: http://bugs.launchpad.net/bugs/987337

This is a partial, self-contained, minimal backport of commit
797fe796c4335b35d95d5326824513befdb5d1e9 upstream which fixes the memory
leak:

Bluetooth: uart-ldisc: Fix memory leak and remove destruct cb

We currently leak the hci_uart object if HCI_UART_PROTO_SET is never set
because the hci-destruct callback will then never be called.  This fix
removes the hci-destruct callback and frees the driver internal private
hci_uart object directly on tty-close. We call hci_unregister_dev() here
so the hci-core will never call our callbacks again (except destruct).
Therefore, we can safely free the driver internal data right away and
set the destruct callback to NULL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/bluetooth/hci_ldisc.c