[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120309155007.GI4497@localhost>
Date: Fri, 9 Mar 2012 16:50:07 +0100
From: Johan Hovold <jhovold@...il.com>
To: David Herrmann <dh.herrmann@...glemail.com>
Cc: "David S. Miller" <davem@...emloft.net>,
linux-bluetooth@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Greg KH <gregkh@...uxfoundation.org>,
stable <stable@...r.kernel.org>,
Marcel Holtmann <marcel@...tmann.org>,
"Gustavo F. Padovan" <padovan@...fusion.mobi>
Subject: Re: [PATCH 2/3] bluetooth: hci_ldisc: fix NULL-pointer dereference
on tty_close
On Fri, Mar 09, 2012 at 04:43:25PM +0100, Johan Hovold wrote:
> Do not close protocol driver until device has been unregistered.
>
> This fixes a race between tty_close and hci_dev_open which can result in
> a NULL-pointer dereference.
>
> The line discipline closes the protocol driver while we may still have
> hci_dev_open sleeping on the req_lock mutex resulting in a NULL-pointer
> dereference when lock is acquired and hci_init_req called.
[...]
> Cc: stable <stable@...r.kernel.org>
> Signed-off-by: Johan Hovold <jhovold@...il.com>
David (Herrmann), I forgot to add your Reviewed-by on this one. Feel
free to add it again if you want to.
Thanks,
Johan
> ---
> 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 97c5faa..5119c4b 100644
> --- a/drivers/bluetooth/hci_ldisc.c
> +++ b/drivers/bluetooth/hci_ldisc.c
> @@ -309,11 +309,11 @@ static void hci_uart_tty_close(struct tty_struct *tty)
> hci_uart_close(hdev);
>
> if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
> - hu->proto->close(hu);
> if (hdev) {
> hci_unregister_dev(hdev);
> hci_free_dev(hdev);
> }
> + hu->proto->close(hu);
> }
> kfree(hu);
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists