{
struct l2cap_chan *c;
- read_lock(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
c = __l2cap_get_chan_by_scid(conn, cid);
if (c)
lock_sock(c->sk);
- read_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
return c;
}
{
struct l2cap_chan *c;
- read_lock(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
c = __l2cap_get_chan_by_ident(conn, ident);
if (c)
lock_sock(c->sk);
- read_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
return c;
}
if (conn) {
/* Delete from channel list */
- write_lock_bh(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
list_del(&chan->list);
- write_unlock_bh(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
chan_put(chan);
chan->conn = NULL;
BT_DBG("conn %p", conn);
- read_lock(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
list_for_each_entry_safe(chan, tmp, &conn->chan_l, list) {
struct sock *sk = chan->sk;
&chan->conf_state)) {
/* l2cap_chan_close() calls list_del(chan)
* so release the lock */
- read_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
l2cap_chan_close(chan, ECONNRESET);
- read_lock(&conn->chan_lock);
+ utex_lock(&conn->chan_lock);
bh_unlock_sock(sk);
continue;
}
bh_unlock_sock(sk);
}
- read_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
}
/* Find socket with cid and source bdaddr.
sk = chan->sk;
- write_lock_bh(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
hci_conn_hold(conn->hcon);
l2cap_state_change(chan, BT_CONNECTED);
parent->sk_data_ready(parent, 0);
- write_unlock_bh(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
clean:
release_sock(parent);
if (conn->hcon->out && conn->hcon->type == LE_LINK)
smp_conn_security(conn, conn->hcon->pending_sec_level);
- read_lock(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
list_for_each_entry(chan, &conn->chan_l, list) {
struct sock *sk = chan->sk;
bh_unlock_sock(sk);
}
- read_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
}
/* Notify sockets that we cannot guaranty reliability anymore */
BT_DBG("conn %p", conn);
- read_lock(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
list_for_each_entry(chan, &conn->chan_l, list) {
struct sock *sk = chan->sk;
sk->sk_err = err;
}
- read_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
}
static void l2cap_info_timeout(unsigned long arg)
conn->feat_mask = 0;
spin_lock_init(&conn->lock);
- rwlock_init(&conn->chan_lock);
+ mutex_init(&conn->chan_lock);
INIT_LIST_HEAD(&conn->chan_l);
static inline void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan)
{
- write_lock_bh(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
__l2cap_chan_add(conn, chan);
- write_unlock_bh(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
}
/* ---- Socket interface ---- */
BT_DBG("conn %p", conn);
- read_lock(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
list_for_each_entry(chan, &conn->chan_l, list) {
struct sock *sk = chan->sk;
if (chan->chan_type != L2CAP_CHAN_RAW)
if (chan->ops->recv(chan->data, nskb))
kfree_skb(nskb);
}
- read_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
}
/* ---- L2CAP signalling commands ---- */
sk = chan->sk;
- write_lock_bh(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
/* Check if we already have channel with that dcid */
if (__l2cap_get_chan_by_dcid(conn, scid)) {
- write_unlock_bh(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
sock_set_flag(sk, SOCK_ZAPPED);
chan->ops->close(chan->data);
goto response;
status = L2CAP_CS_NO_INFO;
}
- write_unlock_bh(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
response:
release_sock(parent);
del_timer(&conn->security_timer);
}
- read_lock(&conn->chan_lock);
+ mutex_lock(&conn->chan_lock);
list_for_each_entry(chan, &conn->chan_l, list) {
struct sock *sk = chan->sk;
bh_unlock_sock(sk);
}
- read_unlock(&conn->chan_lock);
+ mutex_unlock(&conn->chan_lock);
return 0;
}