mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 13:23:02 -04:00
Bluetooth: ISO: validate sockaddr_iso first in iso_sock_rebind_bis()
iso_sock_rebind_bis() updates socket iso_pi(sk)->bc_num_bis before
validating the BIS values, so it's possible to end up with bc_num_bis
inconsistent.
Assign to iso_pi(sk)->bc_num_bis only after validation.
Fixes: 80837140c1 ("Bluetooth: ISO: Allow binding a PA sync socket")
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:
committed by
Luiz Augusto von Dentz
parent
e9cb51813d
commit
4e20192d46
@@ -1039,15 +1039,15 @@ static int iso_sock_rebind_bis(struct sock *sk, struct sockaddr_iso *sa,
|
||||
goto done;
|
||||
}
|
||||
|
||||
iso_pi(sk)->bc_num_bis = sa->iso_bc->bc_num_bis;
|
||||
|
||||
for (int i = 0; i < iso_pi(sk)->bc_num_bis; i++)
|
||||
for (int i = 0; i < sa->iso_bc->bc_num_bis; i++)
|
||||
if (sa->iso_bc->bc_bis[i] < 0x01 ||
|
||||
sa->iso_bc->bc_bis[i] > 0x1f) {
|
||||
err = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
iso_pi(sk)->bc_num_bis = sa->iso_bc->bc_num_bis;
|
||||
|
||||
memcpy(iso_pi(sk)->bc_bis, sa->iso_bc->bc_bis,
|
||||
iso_pi(sk)->bc_num_bis);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user