* [PATCH] Bluetooth: rfcomm: Release BTM while sleeping to avoid deadlock.
@ 2011-02-13 1:01 Владислав
2011-02-14 14:49 ` Gustavo F. Padovan
0 siblings, 1 reply; 3+ messages in thread
From: Владислав @ 2011-02-13 1:01 UTC (permalink / raw)
To: linux-bluetooth
Bug description:
Kernel freezes for ~2 seconds after trying to access /dev/rfcommX device.
Steps to reproduce:
1. Edit /etc/bluetooth/rfcomm.conf - uncomment default config, set "bind" to "yes".
2. Issue "sudo rfcomm bind all" to create /dev/rfcomm0 device node.
3. Issue "cat /dev/rfcomm0" to trigger a bug.
Everything freezes (at least GUI): cursor does not move, no response from
keypresses, no gui redraw for 2~3 seconds.
Then cat displays expected error message "cat: /dev/rfcomm0: Host is down"
and system starts to respond again.
What expected (and occurs with 2.6.35) : no freeze between cat and error message.
Things goes worse when device, mentioned in /etc/bluetooth/rfcomm.conf
is in range and not paired - system displays pairing request and locks
up for a longer time, maybe completely - I did not wait longer than ~30
seconds and turned off bluetooth device.
Fix:
Release BTM while sleeping to avoid deadlock.
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 2575c2d..d7b9af4 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -727,7 +727,9 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
break;
}
+ tty_unlock();
schedule();
+ tty_lock();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&dev->wait, &wait);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: rfcomm: Release BTM while sleeping to avoid deadlock.
2011-02-13 1:01 [PATCH] Bluetooth: rfcomm: Release BTM while sleeping to avoid deadlock Владислав
@ 2011-02-14 14:49 ` Gustavo F. Padovan
[not found] ` <E1Pp0gh-0002s9-00.vladisslav-inbox-ru@f95.mail.ru>
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo F. Padovan @ 2011-02-14 14:49 UTC (permalink / raw)
To: Владислав
Cc: linux-bluetooth
Hi
* Владислав <vladisslav@inbox.ru> [2011-02-13 04:01:45 +0300]:
> Bug description:
> Kernel freezes for ~2 seconds after trying to access /dev/rfcommX device.
> Steps to reproduce:
> 1. Edit /etc/bluetooth/rfcomm.conf - uncomment default config, set "bind" to "yes".
> 2. Issue "sudo rfcomm bind all" to create /dev/rfcomm0 device node.
> 3. Issue "cat /dev/rfcomm0" to trigger a bug.
> Everything freezes (at least GUI): cursor does not move, no response from
> keypresses, no gui redraw for 2~3 seconds.
> Then cat displays expected error message "cat: /dev/rfcomm0: Host is down"
> and system starts to respond again.
> What expected (and occurs with 2.6.35) : no freeze between cat and error message.
> Things goes worse when device, mentioned in /etc/bluetooth/rfcomm.conf
> is in range and not paired - system displays pairing request and locks
> up for a longer time, maybe completely - I did not wait longer than ~30
> seconds and turned off bluetooth device.
>
> Fix:
> Release BTM while sleeping to avoid deadlock.
>
> diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
> index 2575c2d..d7b9af4 100644
> --- a/net/bluetooth/rfcomm/tty.c
> +++ b/net/bluetooth/rfcomm/tty.c
> @@ -727,7 +727,9 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
> break;
> }
>
> + tty_unlock();
> schedule();
> + tty_lock();
> }
> set_current_state(TASK_RUNNING);
> remove_wait_queue(&dev->wait, &wait);
I've faced this issue some days ago and your patch looks good. But I need
proper git patch with your Signed-off-by line.
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: rfcomm: Release BTM while sleeping to avoid deadlock.
[not found] ` <E1Pp0gh-0002s9-00.vladisslav-inbox-ru@f95.mail.ru>
@ 2011-02-14 17:25 ` Gustavo F. Padovan
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo F. Padovan @ 2011-02-14 17:25 UTC (permalink / raw)
To: Vladislav P; +Cc: linux-bluetooth
Hi Vladislav,
* Vladislav P <vladisslav@inbox.ru> [2011-02-14 18:50:07 +0300]:
> Mon, 14 Feb 2011 12:49:31 -0200 письмо от "Gustavo F. Padovan" <padovan@profusion.mobi>:
>
> > Hi
> >
> > * Владислав <vladisslav@inbox.ru> [2011-02-13 04:01:45 +0300]:
> >
> > > Bug description:
> > > Kernel freezes for ~2 seconds after trying to access /dev/rfcommX device.
> > > Steps to reproduce:
> > > 1. Edit /etc/bluetooth/rfcomm.conf - uncomment default config, set "bind" to
> > "yes".
> > > 2. Issue "sudo rfcomm bind all" to create /dev/rfcomm0 device node.
> > > 3. Issue "cat /dev/rfcomm0" to trigger a bug.
> > > Everything freezes (at least GUI): cursor does not move, no response from
> > > keypresses, no gui redraw for 2~3 seconds.
> > > Then cat displays expected error message "cat: /dev/rfcomm0: Host is down"
> > > and system starts to respond again.
> > > What expected (and occurs with 2.6.35) : no freeze between cat and error
> > message.
> > > Things goes worse when device, mentioned in /etc/bluetooth/rfcomm.conf
> > > is in range and not paired - system displays pairing request and locks
> > > up for a longer time, maybe completely - I did not wait longer than ~30
> > > seconds and turned off bluetooth device.
> >
> > I've faced this issue some days ago and your patch looks good. But I need
> > proper git patch with your Signed-off-by line.
> >
> > --
> > Gustavo F. Padovan
> > http://profusion.mobi
> Made proper patch:
>
> From d1459f3042b4b8cdea1f1a184eb61f7be4002203 Mon Sep 17 00:00:00 2001
> From: Vladislav P <vladisslav@inbox.ru>
> Date: Mon, 14 Feb 2011 18:42:27 +0300
> Subject: [PATCH] Release BTM while sleeping to avoid deadlock.
>
> Signed-off-by: Vladislav P <vladisslav@inbox.ru>
> ---
> net/bluetooth/rfcomm/tty.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
Applied, thanks.
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-14 17:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-13 1:01 [PATCH] Bluetooth: rfcomm: Release BTM while sleeping to avoid deadlock Владислав
2011-02-14 14:49 ` Gustavo F. Padovan
[not found] ` <E1Pp0gh-0002s9-00.vladisslav-inbox-ru@f95.mail.ru>
2011-02-14 17:25 ` Gustavo F. Padovan
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.