Skip to content

Commit

Permalink
Bluetooth: Fix poll() misbehavior when using BT_DEFER_SETUP
Browse files Browse the repository at this point in the history
When BT_DEFER_SETUP has been enabled on a Bluetooth socket it keeps
signaling POLLIN all the time. This is a wrong behavior. The POLLIN
should only be signaled if the client socket is in BT_CONNECT2 state
and the parent has been BT_DEFER_SETUP enabled.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Marcel Holtmann committed Feb 27, 2009
1 parent 96a3183 commit d5f2d2b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/bluetooth/af_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,11 @@ static inline unsigned int bt_accept_poll(struct sock *parent)
struct list_head *p, *n;
struct sock *sk;

if (bt_sk(parent)->defer_setup)
return POLLIN | POLLRDNORM;

list_for_each_safe(p, n, &bt_sk(parent)->accept_q) {
sk = (struct sock *) list_entry(p, struct bt_sock, accept_q);
if (sk->sk_state == BT_CONNECTED)
if (sk->sk_state == BT_CONNECTED ||
(bt_sk(parent)->defer_setup &&
sk->sk_state == BT_CONNECT2))
return POLLIN | POLLRDNORM;
}

Expand Down

0 comments on commit d5f2d2b

Please sign in to comment.