mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Justin P. Mattock" <justinmattock@gmail.com>
To: stable@kernel.org
Cc: linux-kernel@vger.kernel.org, greg@kroah.com,
	"Gustavo F. Padovan" <padovan@profusion.mobi>
Subject: [PATCH] Bluetooth: Fix HCI_RESET command synchronization backported to stable
Date: Tue, 12 Apr 2011 08:43:27 -0700	[thread overview]
Message-ID: <1302623007-16402-1-git-send-email-justinmattock@gmail.com> (raw)

backported to stable. did not have the time to compile test this, but patch applies.

Reported-by: Mikko Vinni <mmvinni@yahoo.com>
Reported-by: Justin P. Mattock <justinmattock@gmail.com>
Reported-by: Ed Tomlinson <edt@aei.ca>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Tested-by: Justin P. Mattock <justinmattock@gmail.com>
Tested-by: Mikko Vinni <mmvinni@yahoo.com>
Tested-by: Ed Tomlinson <edt@aei.ca>


diff -Naur linux-2.6.38.2-orig/include/net/bluetooth/hci.h linux-2.6.38.2/include/net/bluetooth/hci.h
--- linux-2.6.38.2-orig/include/net/bluetooth/hci.h	2011-03-27 11:37:20.000000000 -0700
+++ linux-2.6.38.2/include/net/bluetooth/hci.h	2011-04-12 08:27:55.905603867 -0700
@@ -74,6 +74,7 @@
 	HCI_AUTH,
 	HCI_ENCRYPT,
 	HCI_INQUIRY,
+	HCI_RESET,
 
 	HCI_RAW,
 };
diff -Naur linux-2.6.38.2-orig/net/bluetooth/hci_core.c linux-2.6.38.2/net/bluetooth/hci_core.c
--- linux-2.6.38.2-orig/net/bluetooth/hci_core.c	2011-03-27 11:37:20.000000000 -0700
+++ linux-2.6.38.2/net/bluetooth/hci_core.c	2011-04-12 08:29:40.178300280 -0700
@@ -184,6 +184,7 @@
 	BT_DBG("%s %ld", hdev->name, opt);
 
 	/* Reset device */
+	set_bit(HCI_RESET, &hdev->flags);
 	hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
 }
 
@@ -210,7 +211,8 @@
 	/* Mandatory initialization */
 
 	/* Reset */
-	if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))
+	if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
+                        set_bit(HCI_RESET, &hdev->flags);
 			hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
 
 	/* Read Local Supported Features */
diff -Naur linux-2.6.38.2-orig/net/bluetooth/hci_event.c linux-2.6.38.2/net/bluetooth/hci_event.c
--- linux-2.6.38.2-orig/net/bluetooth/hci_event.c	2011-03-27 11:37:20.000000000 -0700
+++ linux-2.6.38.2/net/bluetooth/hci_event.c	2011-04-12 08:30:54.816367176 -0700
@@ -183,6 +183,8 @@
 
 	BT_DBG("%s status 0x%x", hdev->name, status);
 
+	clear_bit(HCI_RESET, &hdev->flags);
+
 	hci_req_complete(hdev, HCI_OP_RESET, status);
 }
 
@@ -1398,7 +1400,7 @@
 		break;
 	}
 
-	if (ev->ncmd) {
+	if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) {
 		atomic_set(&hdev->cmd_cnt, 1);
 		if (!skb_queue_empty(&hdev->cmd_q))
 			tasklet_schedule(&hdev->cmd_task);

             reply	other threads:[~2011-04-12 15:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12 15:43 Justin P. Mattock [this message]
2011-04-14 23:40 ` [stable] " Greg KH

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=1302623007-16402-1-git-send-email-justinmattock@gmail.com \
    --to=justinmattock@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=padovan@profusion.mobi \
    --cc=stable@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

all inboxes | Powered by JetHome®