提交 27c24fda 编写于 作者: D Desmond Cheong Zhi Xi 提交者: Luiz Augusto von Dentz

Bluetooth: switch to lock_sock in SCO

Since sco_sock_timeout is now scheduled using delayed work, it is no
longer run in SOFTIRQ context. Hence bh_lock_sock is no longer
necessary in SCO to synchronise between user contexts and SOFTIRQ
processing.

As such, calls to bh_lock_sock should be replaced with lock_sock to
synchronize with other concurrent processes that use lock_sock.
Signed-off-by: NDesmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Signed-off-by: NLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
上级 734bc5ff
...@@ -93,10 +93,10 @@ static void sco_sock_timeout(struct work_struct *work) ...@@ -93,10 +93,10 @@ static void sco_sock_timeout(struct work_struct *work)
BT_DBG("sock %p state %d", sk, sk->sk_state); BT_DBG("sock %p state %d", sk, sk->sk_state);
bh_lock_sock(sk); lock_sock(sk);
sk->sk_err = ETIMEDOUT; sk->sk_err = ETIMEDOUT;
sk->sk_state_change(sk); sk->sk_state_change(sk);
bh_unlock_sock(sk); release_sock(sk);
sco_sock_kill(sk); sco_sock_kill(sk);
sock_put(sk); sock_put(sk);
...@@ -193,10 +193,10 @@ static void sco_conn_del(struct hci_conn *hcon, int err) ...@@ -193,10 +193,10 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
if (sk) { if (sk) {
sock_hold(sk); sock_hold(sk);
bh_lock_sock(sk); lock_sock(sk);
sco_sock_clear_timer(sk); sco_sock_clear_timer(sk);
sco_chan_del(sk, err); sco_chan_del(sk, err);
bh_unlock_sock(sk); release_sock(sk);
sco_sock_kill(sk); sco_sock_kill(sk);
sock_put(sk); sock_put(sk);
...@@ -1105,10 +1105,10 @@ static void sco_conn_ready(struct sco_conn *conn) ...@@ -1105,10 +1105,10 @@ static void sco_conn_ready(struct sco_conn *conn)
if (sk) { if (sk) {
sco_sock_clear_timer(sk); sco_sock_clear_timer(sk);
bh_lock_sock(sk); lock_sock(sk);
sk->sk_state = BT_CONNECTED; sk->sk_state = BT_CONNECTED;
sk->sk_state_change(sk); sk->sk_state_change(sk);
bh_unlock_sock(sk); release_sock(sk);
} else { } else {
sco_conn_lock(conn); sco_conn_lock(conn);
...@@ -1123,12 +1123,12 @@ static void sco_conn_ready(struct sco_conn *conn) ...@@ -1123,12 +1123,12 @@ static void sco_conn_ready(struct sco_conn *conn)
return; return;
} }
bh_lock_sock(parent); lock_sock(parent);
sk = sco_sock_alloc(sock_net(parent), NULL, sk = sco_sock_alloc(sock_net(parent), NULL,
BTPROTO_SCO, GFP_ATOMIC, 0); BTPROTO_SCO, GFP_ATOMIC, 0);
if (!sk) { if (!sk) {
bh_unlock_sock(parent); release_sock(parent);
sco_conn_unlock(conn); sco_conn_unlock(conn);
return; return;
} }
...@@ -1149,7 +1149,7 @@ static void sco_conn_ready(struct sco_conn *conn) ...@@ -1149,7 +1149,7 @@ static void sco_conn_ready(struct sco_conn *conn)
/* Wake up parent */ /* Wake up parent */
parent->sk_data_ready(parent); parent->sk_data_ready(parent);
bh_unlock_sock(parent); release_sock(parent);
sco_conn_unlock(conn); sco_conn_unlock(conn);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册