* [PATCH] Bluetooth: ISO: zero the sockaddr before returning it in getname
@ 2026-08-06 23:06 Ali Ahmet Memis
2026-08-07 1:14 ` bluez.test.bot
2026-08-07 16:30 ` [PATCH] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Ali Ahmet Memis @ 2026-08-06 23:06 UTC (permalink / raw)
To: Luiz Augusto von Dentz, Marcel Holtmann
Cc: Pauli Virtanen, linux-bluetooth, linux-kernel, stable
iso_sock_getname() fills a struct sockaddr_iso in place and returns its
size without clearing it first, so bytes it does not write are copied to
user space from the kernel stack. The getsockname(2) and getpeername(2)
paths both run through do_getsockname(), which hands getname() an
uninitialized sockaddr_storage on the stack and copies back up to the
number of bytes getname() returns, so the driver has to initialize every
byte it accounts for.
Two ranges are left uninitialized:
- struct sockaddr_iso is 10 bytes but only 9 are written (family,
iso_bdaddr, iso_bdaddr_type), leaking the trailing pad byte on every
call.
- for a broadcast peer (BIS_LINK or PA_LINK) the returned length grows
by sizeof(struct sockaddr_iso_bc), but only bc_sid, bc_num_bis and
bc_bis are filled; bc_bdaddr and bc_bdaddr_type, the first 7 bytes of
that structure, are never written.
An unprivileged process can open a BTPROTO_ISO socket and reach the pad
leak with getsockname(); the broadcast leak needs an established BIS/PA
connection. l2cap and rfcomm already memset their sockaddr in getname
for the same reason; do the same here.
Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
Fixes: 0a766a0affb5 ("Bluetooth: ISO: Fix getpeername not returning sockaddr_iso_bc fields")
Cc: stable@vger.kernel.org
Signed-off-by: Ali Ahmet Memis <ali@iusegentoo.com>
---
net/bluetooth/iso.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index a461c8a4efed..e5b2168e8819 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -1536,6 +1536,7 @@ static int iso_sock_getname(struct socket *sock, struct sockaddr *addr,
lock_sock(sk);
+ memset(sa, 0, sizeof(struct sockaddr_iso));
addr->sa_family = AF_BLUETOOTH;
if (peer) {
@@ -1546,6 +1547,7 @@ static int iso_sock_getname(struct socket *sock, struct sockaddr *addr,
sa->iso_bdaddr_type = iso_pi(sk)->dst_type;
if (hcon && (hcon->type == BIS_LINK || hcon->type == PA_LINK)) {
+ memset(sa->iso_bc, 0, sizeof(struct sockaddr_iso_bc));
sa->iso_bc->bc_sid = iso_pi(sk)->bc_sid;
sa->iso_bc->bc_num_bis = iso_pi(sk)->bc_num_bis;
memcpy(sa->iso_bc->bc_bis, iso_pi(sk)->bc_bis,
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: ISO: zero the sockaddr before returning it in getname
2026-08-06 23:06 [PATCH] Bluetooth: ISO: zero the sockaddr before returning it in getname Ali Ahmet Memis
@ 2026-08-07 1:14 ` bluez.test.bot
2026-08-07 16:30 ` [PATCH] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-08-07 1:14 UTC (permalink / raw)
To: linux-bluetooth, ali
[-- Attachment #1: Type: text/plain, Size: 1235 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1141806
---Test result---
Test Summary:
CheckPatch PASS 0.76 seconds
VerifyFixes PASS 0.14 seconds
VerifySignedoff PASS 0.14 seconds
GitLint PASS 0.34 seconds
SubjectPrefix PASS 0.13 seconds
BuildKernel PASS 27.70 seconds
CheckAllWarning PASS 30.30 seconds
CheckSparse PASS 29.18 seconds
BuildKernel32 PASS 27.01 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 506.95 seconds
TestRunner_iso-tester PASS 84.12 seconds
IncrementalBuild PASS 26.25 seconds
Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
https://github.com/bluez/bluetooth-next/pull/543
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: ISO: zero the sockaddr before returning it in getname
2026-08-06 23:06 [PATCH] Bluetooth: ISO: zero the sockaddr before returning it in getname Ali Ahmet Memis
2026-08-07 1:14 ` bluez.test.bot
@ 2026-08-07 16:30 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-08-07 16:30 UTC (permalink / raw)
To: Ali Ahmet Memis
Cc: luiz.dentz, marcel, pav, linux-bluetooth, linux-kernel, stable
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 6 Aug 2026 23:06:21 +0000 you wrote:
> iso_sock_getname() fills a struct sockaddr_iso in place and returns its
> size without clearing it first, so bytes it does not write are copied to
> user space from the kernel stack. The getsockname(2) and getpeername(2)
> paths both run through do_getsockname(), which hands getname() an
> uninitialized sockaddr_storage on the stack and copies back up to the
> number of bytes getname() returns, so the driver has to initialize every
> byte it accounts for.
>
> [...]
Here is the summary with links:
- Bluetooth: ISO: zero the sockaddr before returning it in getname
https://git.kernel.org/bluetooth/bluetooth-next/c/e25de80035a3
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-07 16:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-06 23:06 [PATCH] Bluetooth: ISO: zero the sockaddr before returning it in getname Ali Ahmet Memis
2026-08-07 1:14 ` bluez.test.bot
2026-08-07 16:30 ` [PATCH] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox