Skip to content

Commit 2df108c

Browse files
committed
Bluetooth: ISO: Fix using BT_SK_PA_SYNC to detect BIS sockets
BT_SK_PA_SYNC is only valid for Broadcast Sinks which means socket used for Broadcast Sources wouldn't be able to use the likes of getpeername to read out the sockaddr_iso_bc fields which may have been update (e.g. bc_sid). Fixes: 0a766a0 ("Bluetooth: ISO: Fix getpeername not returning sockaddr_iso_bc fields") Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 47c0390 commit 2df108c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/bluetooth/iso.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,10 +1337,13 @@ static int iso_sock_getname(struct socket *sock, struct sockaddr *addr,
13371337
addr->sa_family = AF_BLUETOOTH;
13381338

13391339
if (peer) {
1340+
struct hci_conn *hcon = iso_pi(sk)->conn ?
1341+
iso_pi(sk)->conn->hcon : NULL;
1342+
13401343
bacpy(&sa->iso_bdaddr, &iso_pi(sk)->dst);
13411344
sa->iso_bdaddr_type = iso_pi(sk)->dst_type;
13421345

1343-
if (test_bit(BT_SK_PA_SYNC, &iso_pi(sk)->flags)) {
1346+
if (hcon && hcon->type == BIS_LINK) {
13441347
sa->iso_bc->bc_sid = iso_pi(sk)->bc_sid;
13451348
sa->iso_bc->bc_num_bis = iso_pi(sk)->bc_num_bis;
13461349
memcpy(sa->iso_bc->bc_bis, iso_pi(sk)->bc_bis,

0 commit comments

Comments
 (0)