All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Newall <david@davidnewall.com>
To: Arjan van de Ven <arjan@linux.intel.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Marcel Holtmann <marcel@holtmann.org>,
	linux-kernel@vger.kernel.org
Subject: Re: Kernel bug: bluetooth meets TTY layer
Date: Fri, 21 Dec 2007 06:10:15 +1030	[thread overview]
Message-ID: <476AC51F.70400@davidnewall.com> (raw)
In-Reply-To: <476A895C.7040903@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 714 bytes --]

Hi Arjan,

I've not been able to find this file, "drivers/bluetooth/hci_tty.c", but 
anyway, This seems to be what happens: Hci_uart_close() flushes using 
hci_uart_flush().  Subsequently, in hci_dev_do_close(), (one step in 
hci_unregister_dev()), hci_uart_flush() is called again.  The comment in 
uart_flush_buffer(), relating to the WARN_ON(), indicates you can't 
flush after the port is closed; which sounds reasonable.  I think 
hci_uart_close() should set hdev->flush to NULL before returning.  
Hci_dev_do_close() does check for this.  The code path is rather 
involved and I'm not entirely clear of all steps, but I think that's 
what should be done.

Patch for stupidly obsolete kernel attached.

David

[-- Attachment #2: hci_ldisc.c.patch --]
[-- Type: text/x-diff, Size: 513 bytes --]

--- hci_ldisc.c	2007-09-11 02:54:02.000000000 +0930
+++ hci_ldisc.c.new	2007-12-21 06:03:11.000000000 +1030
@@ -203,16 +203,17 @@
 static int hci_uart_close(struct hci_dev *hdev)
 {
 	BT_DBG("hdev %p", hdev);
 
 	if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
 		return 0;
 
 	hci_uart_flush(hdev);
+	hdev->flush = NULL;
 	return 0;
 }
 
 /* Send frames from HCI layer */
 static int hci_uart_send_frame(struct sk_buff *skb)
 {
 	struct hci_dev* hdev = (struct hci_dev *) skb->dev;
 	struct tty_struct *tty;

  reply	other threads:[~2007-12-20 19:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-20 15:25 Kernel bug: bluetooth meets TTY layer Arjan van de Ven
2007-12-20 19:40 ` David Newall [this message]
2007-12-20 20:17   ` Arjan van de Ven
2007-12-20 21:26     ` Alan Cox

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=476AC51F.70400@davidnewall.com \
    --to=david@davidnewall.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.