linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Imran Haider <imran1008@gmail.com>
To: marcel@holtmann.org, padovan@profusion.mobi
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	Imran Haider <imran1008@gmail.com>
Subject: [PATCH] Bluetooth: Don't sleep after deleting command timer
Date: Fri, 22 Apr 2011 19:02:42 -0400	[thread overview]
Message-ID: <1303513362-9357-1-git-send-email-imran1008@gmail.com> (raw)

This fix adds on to commit b77dcf84. It seems that scheduling a timeout
of 250ms after deleting the command timer causes a kernel panic when
system is resuming from Suspend-to-RAM. I tried adding another timeout
before deleting the command timer but that didn't help so I believe that
some code in hci_dev_do_close must execute after the command timer is
deleted before control is returned to another thread.

The only bit the command timer handler hci_cmd_timer() touches is HCI_RESET.
It should be fine to delete the timer after testing the HCI_UP bit.
---
 net/bluetooth/hci_core.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index c83f618..398ec93 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -587,10 +587,10 @@ static int hci_dev_do_close(struct hci_dev *hdev)
 	hci_req_cancel(hdev, ENODEV);
 	hci_req_lock(hdev);
 
-	/* Stop timer, it might be running */
-	del_timer_sync(&hdev->cmd_timer);
-
 	if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
+		/* Stop timer, it might be running */
+		del_timer_sync(&hdev->cmd_timer);
+
 		hci_req_unlock(hdev);
 		return 0;
 	}
@@ -619,6 +619,9 @@ static int hci_dev_do_close(struct hci_dev *hdev)
 		clear_bit(HCI_INIT, &hdev->flags);
 	}
 
+	/* Stop timer, it might be running */
+	del_timer_sync(&hdev->cmd_timer);
+
 	/* Kill cmd task */
 	tasklet_kill(&hdev->cmd_task);
 
-- 
1.7.3.4


             reply	other threads:[~2011-04-22 23:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 23:02 Imran Haider [this message]
2011-04-26 15:49 ` [PATCH] Bluetooth: Don't sleep after deleting command timer Gustavo F. Padovan

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=1303513362-9357-1-git-send-email-imran1008@gmail.com \
    --to=imran1008@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=padovan@profusion.mobi \
    /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).