Skip to content

Commit

Permalink
Bluetooth: ISO: Fix handling of listen for unicast
Browse files Browse the repository at this point in the history
[ Upstream commit e0275ea ]

iso_listen_cis shall only return -EADDRINUSE if the listening socket has
the destination set to BDADDR_ANY otherwise if the destination is set to
a specific address it is for broadcast which shall be ignored.

Fixes: f764a6c ("Bluetooth: ISO: Add broadcast support")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Luiz Augusto von Dentz authored and Greg Kroah-Hartman committed Oct 10, 2023
1 parent c201d94 commit 6bfc4c7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/bluetooth/iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,18 @@ static void iso_recv_frame(struct iso_conn *conn, struct sk_buff *skb)
}

/* -------- Socket interface ---------- */
static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *ba)
static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *src, bdaddr_t *dst)
{
struct sock *sk;

sk_for_each(sk, &iso_sk_list.head) {
if (sk->sk_state != BT_LISTEN)
continue;

if (!bacmp(&iso_pi(sk)->src, ba))
if (bacmp(&iso_pi(sk)->dst, dst))
continue;

if (!bacmp(&iso_pi(sk)->src, src))
return sk;
}

Expand Down Expand Up @@ -910,7 +913,7 @@ static int iso_listen_cis(struct sock *sk)

write_lock(&iso_sk_list.lock);

if (__iso_get_sock_listen_by_addr(&iso_pi(sk)->src))
if (__iso_get_sock_listen_by_addr(&iso_pi(sk)->src, &iso_pi(sk)->dst))
err = -EADDRINUSE;

write_unlock(&iso_sk_list.lock);
Expand Down

0 comments on commit 6bfc4c7

Please sign in to comment.