Bluetooth: L2CAP: add locking annotations for l2cap_chan_lock/unlock

Add minimal context analysis annotations to l2cap_chan_lock/unlock() and
callers required for no warnings.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Pauli Virtanen 2026-08-16 12:47:04 +03:00 committed by Luiz Augusto von Dentz
parent 15ad901d92
commit 987935a58d
3 changed files with 4 additions and 0 deletions

View File

@ -830,11 +830,13 @@ struct l2cap_chan *l2cap_chan_hold_unless_zero(struct l2cap_chan *c);
void l2cap_chan_put(struct l2cap_chan *c);
static inline void l2cap_chan_lock(struct l2cap_chan *chan)
__acquires(&chan->lock)
{
mutex_lock_nested(&chan->lock, atomic_read(&chan->nesting));
}
static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
__releases(&chan->lock)
{
mutex_unlock(&chan->lock);
}

View File

@ -4096,6 +4096,7 @@ static struct l2cap_chan *l2cap_new_connection(struct l2cap_conn *conn,
static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
u8 *data, u8 rsp_code)
__context_unsafe(/* conditional locking */)
{
struct l2cap_conn_req *req = (struct l2cap_conn_req *) data;
struct l2cap_conn_rsp rsp;

View File

@ -1784,6 +1784,7 @@ static void l2cap_sock_state_change_cb(struct l2cap_chan *chan, int state,
static struct sk_buff *l2cap_sock_alloc_skb_cb(struct l2cap_chan *chan,
unsigned long hdr_len,
unsigned long len, int nb)
__must_hold(&chan->lock)
{
struct sock *sk = chan->data;
struct sk_buff *skb;