linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <jhovold@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>,
	"Gustavo F. Padovan" <padovan@profusion.mobi>
Cc: "David S. Miller" <davem@davemloft.net>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org,
	David Herrmann <dh.herrmann@googlemail.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Johan Hovold <jhovold@gmail.com>, stable <stable@vger.kernel.org>
Subject: [PATCH 1/3] bluetooth: hci_ldisc: fix memory leak on tty_close
Date: Fri,  9 Mar 2012 16:43:24 +0100	[thread overview]
Message-ID: <1331307806-21761-2-git-send-email-jhovold@gmail.com> (raw)
In-Reply-To: <1331307806-21761-1-git-send-email-jhovold@gmail.com>

The hci_uart is never freed when tty is closed if the protocol has not
been set.

This was discovered by David Hermann and fixed in bluetooth-next. Those
patches are more intrusive as they remove the mandatory destructor
completely.

This is the minimal fix, which leaves the destructor as an empty dummy
call for now.

Cc: David Herrmann <dh.herrmann@googlemail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
---
 drivers/bluetooth/hci_ldisc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 0711448..97c5faa 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -237,7 +237,6 @@ static void hci_uart_destruct(struct hci_dev *hdev)
 		return;
 
 	BT_DBG("%s", hdev->name);
-	kfree(hdev->driver_data);
 }
 
 /* ------ LDISC part ------ */
@@ -316,6 +315,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)
 				hci_free_dev(hdev);
 			}
 		}
+		kfree(hu);
 	}
 }
 
-- 
1.7.8.4


  reply	other threads:[~2012-03-09 15:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09 15:43 [PATCH 0/3] bluetooth: bug fixes for 3.3 Johan Hovold
2012-03-09 15:43 ` Johan Hovold [this message]
2012-03-09 15:43 ` [PATCH 2/3] bluetooth: hci_ldisc: fix NULL-pointer dereference on tty_close Johan Hovold
2012-03-09 15:50   ` Johan Hovold
2012-03-09 15:43 ` [PATCH 3/3] bluetooth: hci_core: fix NULL-pointer dereference at unregister Johan Hovold
2012-03-14 11:25 ` [PATCH 0/3] bluetooth: bug fixes for 3.3 Johan Hovold
2012-03-14 18:16   ` Marcel Holtmann
2012-03-15 13:47     ` bluetooth: bug fixes for bluetooth-next Johan Hovold
2012-03-15 13:48       ` [PATCH 1/2] bluetooth: hci_ldisc: fix NULL-pointer dereference on tty_close Johan Hovold
2012-03-15 13:48         ` [PATCH 2/2] bluetooth: hci_core: fix NULL-pointer dereference at unregister Johan Hovold
2012-03-15 15:23           ` Marcel Holtmann
2012-03-15 15:21         ` [PATCH 1/2] bluetooth: hci_ldisc: fix NULL-pointer dereference on tty_close Marcel Holtmann
2012-03-16 16:03           ` Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331307806-21761-2-git-send-email-jhovold@gmail.com \
    --to=jhovold@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dh.herrmann@googlemail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    --cc=padovan@profusion.mobi \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).