Re: [syzbot] [bluetooth?] [usb?] memory leak in __hci_cmd_sync_sk

syzbot
2025-11-18T03:54:02Z

Hello,

syzbot tried to test the proposed patch but the build/boot failed:

BUG: unable to handle kernel NULL pointer dereference in __hci_cmd_sync_status_sk

BUG: kernel NULL pointer dereference, address: 00000000000000d8
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 0 P4D 0
Oops: Oops: 0000 [#1] SMP PTI
CPU: 1 UID: 0 PID: 5134 Comm: kworker/u9:1 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Workqueue: hci0 hci_power_on
RIP: 0010:__hci_cmd_sync_status_sk+0x7e/0x100 net/bluetooth/hci_sync.c:276
Code: 7b 78 fc 48 89 de 48 c7 c7 00 f0 ff ff e8 3a 74 78 fc 48 81 fb 00 f0 ff ff 77 3c e8 8c 7b 78 fc ba 02 00 00 00 48 89 de 31 ff <48> 8b 83 d8 00 00 00 0f b6 28 e8 83 74 87 ff e8 6e 7b 78 fc 89 e8
RSP: 0018:ffffc9000c087d58 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff84e919d6
RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000c03 R08: 0000000000000007 R09: fffffffffffff000
R10: 0000000000000000 R11: ffff88810c72bf00 R12: 0000000000000000
R13: ffff88810e0be000 R14: 0000000000000090 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8881b26c2000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000000000d8 CR3: 00000001198b4000 CR4: 00000000003526f0
Call Trace:
<TASK>
__hci_cmd_sync_status net/bluetooth/hci_sync.c:287 [inline]
hci_reset_sync net/bluetooth/hci_sync.c:3664 [inline]
hci_init1_sync net/bluetooth/hci_sync.c:3750 [inline]
hci_init_sync net/bluetooth/hci_sync.c:4867 [inline]
hci_dev_init_sync net/bluetooth/hci_sync.c:5059 [inline]
hci_dev_open_sync+0x5aa/0x1080 net/bluetooth/hci_sync.c:5137
hci_dev_do_open net/bluetooth/hci_core.c:430 [inline]
hci_power_on+0x87/0x330 net/bluetooth/hci_core.c:959
process_one_work+0x26b/0x620 kernel/workqueue.c:3263
process_scheduled_works kernel/workqueue.c:3346 [inline]
worker_thread+0x2c4/0x4f0 kernel/workqueue.c:3427
kthread+0x15b/0x310 kernel/kthread.c:463
ret_from_fork+0x210/0x240 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Modules linked in:
CR2: 00000000000000d8
---[ end trace 0000000000000000 ]---
RIP: 0010:__hci_cmd_sync_status_sk+0x7e/0x100 net/bluetooth/hci_sync.c:276
Code: 7b 78 fc 48 89 de 48 c7 c7 00 f0 ff ff e8 3a 74 78 fc 48 81 fb 00 f0 ff ff 77 3c e8 8c 7b 78 fc ba 02 00 00 00 48 89 de 31 ff <48> 8b 83 d8 00 00 00 0f b6 28 e8 83 74 87 ff e8 6e 7b 78 fc 89 e8
RSP: 0018:ffffc9000c087d58 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff84e919d6
RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000c03 R08: 0000000000000007 R09: fffffffffffff000
R10: 0000000000000000 R11: ffff88810c72bf00 R12: 0000000000000000
R13: ffff88810e0be000 R14: 0000000000000090 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8881b26c2000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000000000d8 CR3: 00000001198b4000 CR4: 00000000003526f0
----------------
Code disassembly (best guess):
0: 7b 78 jnp 0x7a
2: fc cld
3: 48 89 de mov %rbx,%rsi
6: 48 c7 c7 00 f0 ff ff mov $0xfffffffffffff000,%rdi
d: e8 3a 74 78 fc call 0xfc78744c
12: 48 81 fb 00 f0 ff ff cmp $0xfffffffffffff000,%rbx
19: 77 3c ja 0x57
1b: e8 8c 7b 78 fc call 0xfc787bac
20: ba 02 00 00 00 mov $0x2,%edx
25: 48 89 de mov %rbx,%rsi
28: 31 ff xor %edi,%edi
* 2a: 48 8b 83 d8 00 00 00 mov 0xd8(%rbx),%rax <-- trapping instruction
31: 0f b6 28 movzbl (%rax),%ebp
34: e8 83 74 87 ff call 0xff8774bc
39: e8 6e 7b 78 fc call 0xfc787bac
3e: 89 e8 mov %ebp,%eax

Warning: Permanently added '10.128.1.249' (ED25519) to the list of known hosts.
2025/11/18 03:52:43 parsed 1 programs
[ 39.605035][ T5812] cgroup: Unknown subsys name 'net'
[ 39.718206][ T5812] cgroup: Unknown subsys name 'cpuset'
[ 39.725182][ T5812] cgroup: Unknown subsys name 'rlimit'
Setting up swapspace version 1, size = 127995904 bytes
[ 47.625088][ T5812] Adding 124996k swap on ./swap-file. Priority:0 extents:1 across:124996k
[ 48.821383][ T5824] soft_limit_in_bytes is deprecated and will be removed. Please report your usecase to linux-mm@kvack.org if you depend on this functionality.
[ 48.930584][ T5829] chnl_net:caif_netlink_parms(): no params data found
[ 48.949691][ T5829] bridge0: port 1(bridge_slave_0) entered blocking state
[ 48.956768][ T5829] bridge0: port 1(bridge_slave_0) entered disabled state
[ 48.964113][ T5829] bridge_slave_0: entered allmulticast mode
[ 48.970539][ T5829] bridge_slave_0: entered promiscuous mode
[ 48.976864][ T5829] bridge0: port 2(bridge_slave_1) entered blocking state
[ 48.984045][ T5829] bridge0: port 2(bridge_slave_1) entered disabled state
[ 48.991247][ T5829] bridge_slave_1: entered allmulticast mode
[ 48.997453][ T5829] bridge_slave_1: entered promiscuous mode
[ 49.008461][ T5829] bond0: (slave bond_slave_0): Enslaving as an active interface with an up link
[ 49.018458][ T5829] bond0: (slave bond_slave_1): Enslaving as an active interface with an up link
[ 49.033238][ T5829] team0: Port device team_slave_0 added
[ 49.039522][ T5829] team0: Port device team_slave_1 added
[ 49.049010][ T5829] batman_adv: batadv0: Adding interface: batadv_slave_0
[ 49.056032][ T5829] batman_adv: batadv0: The MTU of interface batadv_slave_0 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1532 would solve the problem.
[ 49.082173][ T5829] batman_adv: batadv0: Not using interface batadv_slave_0 (retrying later): interface not active
[ 49.093168][ T5829] batman_adv: batadv0: Adding interface: batadv_slave_1
[ 49.100231][ T5829] batman_adv: batadv0: The MTU of interface batadv_slave_1 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1532 would solve the problem.
[ 49.126190][ T5829] batman_adv: batadv0: Not using interface batadv_slave_1 (retrying later): interface not active
[ 49.143192][ T5829] hsr_slave_0: entered promiscuous mode
[ 49.149035][ T5829] hsr_slave_1: entered promiscuous mode
[ 49.176213][ T5829] netdevsim netdevsim0 netdevsim0: renamed from eth0
[ 49.184012][ T5829] netdevsim netdevsim0 netdevsim1: renamed from eth1
[ 49.191721][ T5829] netdevsim netdevsim0 netdevsim2: renamed from eth2
[ 49.199377][ T5829] netdevsim netdevsim0 netdevsim3: renamed from eth3
[ 49.210938][ T5829] bridge0: port 2(bridge_slave_1) entered blocking state
[ 49.217991][ T5829] bridge0: port 2(bridge_slave_1) entered forwarding state
[ 49.225334][ T5829] bridge0: port 1(bridge_slave_0) entered blocking state
[ 49.232427][ T5829] bridge0: port 1(bridge_slave_0) entered forwarding state
[ 49.249559][ T5829] 8021q: adding VLAN 0 to HW filter on device bond0
[ 49.259076][ T1811] bridge0: port 1(bridge_slave_0) entered disabled state
[ 49.266510][ T1811] bridge0: port 2(bridge_slave_1) entered disabled state
[ 49.276312][ T5829] 8021q: adding VLAN 0 to HW filter on device team0
[ 49.285041][ T35] bridge0: port 1(bridge_slave_0) entered blocking state
[ 49.292228][ T35] bridge0: port 1(bridge_slave_0) entered forwarding state
[ 49.301049][ T1811] bridge0: port 2(bridge_slave_1) entered blocking state
[ 49.308132][ T1811] bridge0: port 2(bridge_slave_1) entered forwarding state
[ 49.346750][ T5829] 8021q: adding VLAN 0 to HW filter on device batadv0
[ 49.361904][ T5829] veth0_vlan: entered promiscuous mode
[ 49.368744][ T5829] veth1_vlan: entered promiscuous mode
[ 49.379509][ T5829] veth0_macvtap: entered promiscuous mode
[ 49.386208][ T5829] veth1_macvtap: entered promiscuous mode
[ 49.395078][ T5829] batman_adv: batadv0: Interface activated: batadv_slave_0
[ 49.404897][ T5829] batman_adv: batadv0: Interface activated: batadv_slave_1
[ 49.414036][ T1811] netdevsim netdevsim0 netdevsim0: set [1, 0] type 2 family 0 port 6081 - 0
[ 49.422836][ T1811] netdevsim netdevsim0 netdevsim1: set [1, 0] type 2 family 0 port 6081 - 0
[ 49.431714][ T1811] netdevsim netdevsim0 netdevsim2: set [1, 0] type 2 family 0 port 6081 - 0
[ 49.440751][ T1811] netdevsim netdevsim0 netdevsim3: set [1, 0] type 2 family 0 port 6081 - 0
[ 49.511385][ T1037] netdevsim netdevsim0 netdevsim3 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
[ 49.548614][ T1037] netdevsim netdevsim0 netdevsim2 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
[ 49.598642][ T1037] netdevsim netdevsim0 netdevsim1 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0
[ 49.619824][ T5868] Bluetooth: hci0: unexpected cc 0x0c03 length: 249 > 1
[ 49.626860][ T5134] BUG: kernel NULL pointer dereference, address: 00000000000000d8
[ 49.634660][ T5134] #PF: supervisor read access in kernel mode
[ 49.640614][ T5134] #PF: error_code(0x0000) - not-present page
[ 49.646656][ T5134] PGD 0 P4D 0
[ 49.650092][ T5134] Oops: Oops: 0000 [#1] SMP PTI
[ 49.654923][ T5134] CPU: 1 UID: 0 PID: 5134 Comm: kworker/u9:1 Not tainted syzkaller #0 PREEMPT(full)
[ 49.664549][ T5134] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
[ 49.674941][ T5134] Workqueue: hci0 hci_power_on
[ 49.679690][ T5134] RIP: 0010:__hci_cmd_sync_status_sk+0x7e/0x100
[ 49.686004][ T5134] Code: 7b 78 fc 48 89 de 48 c7 c7 00 f0 ff ff e8 3a 74 78 fc 48 81 fb 00 f0 ff ff 77 3c e8 8c 7b 78 fc ba 02 00 00 00 48 89 de 31 ff <48> 8b 83 d8 00 00 00 0f b6 28 e8 83 74 87 ff e8 6e 7b 78 fc 89 e8
[ 49.706025][ T5134] RSP: 0018:ffffc9000c087d58 EFLAGS: 00010246
[ 49.712243][ T5134] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff84e919d6
[ 49.720299][ T5134] RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
[ 49.728434][ T5134] RBP: 0000000000000c03 R08: 0000000000000007 R09: fffffffffffff000
[ 49.736819][ T5134] R10: 0000000000000000 R11: ffff88810c72bf00 R12: 0000000000000000
[ 49.744762][ T5134] R13: ffff88810e0be000 R14: 0000000000000090 R15: 0000000000000000
[ 49.752713][ T5134] FS: 0000000000000000(0000) GS:ffff8881b26c2000(0000) knlGS:0000000000000000
[ 49.761620][ T5134] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 49.768180][ T5134] CR2: 00000000000000d8 CR3: 00000001198b4000 CR4: 00000000003526f0
[ 49.776129][ T5134] Call Trace:
[ 49.779402][ T5134] <TASK>
[ 49.782334][ T5134] hci_dev_open_sync+0x5aa/0x1080
[ 49.787364][ T5134] ? __schedule+0x4c2/0x1990
[ 49.792031][ T5134] hci_power_on+0x87/0x330
[ 49.796517][ T5134] ? pwq_dec_nr_in_flight+0x78/0x560
[ 49.801872][ T5134] process_one_work+0x26b/0x620
[ 49.806804][ T5134] worker_thread+0x2c4/0x4f0
[ 49.811464][ T5134] ? __pfx_worker_thread+0x10/0x10
[ 49.816550][ T5134] kthread+0x15b/0x310
[ 49.820623][ T5134] ? finish_task_switch.isra.0+0x86/0x280
[ 49.826410][ T5134] ? __pfx_kthread+0x10/0x10
[ 49.831068][ T5134] ? __pfx_kthread+0x10/0x10
[ 49.835908][ T5134] ret_from_fork+0x210/0x240
[ 49.840494][ T5134] ? __pfx_kthread+0x10/0x10
[ 49.845100][ T5134] ret_from_fork_asm+0x1a/0x30
[ 49.849853][ T5134] </TASK>
[ 49.852851][ T5134] Modules linked in:
[ 49.856737][ T5134] CR2: 00000000000000d8
[ 49.861042][ T5134] ---[ end trace 0000000000000000 ]---
[ 49.866474][ T5134] RIP: 0010:__hci_cmd_sync_status_sk+0x7e/0x100
[ 49.872872][ T5134] Code: 7b 78 fc 48 89 de 48 c7 c7 00 f0 ff ff e8 3a 74 78 fc 48 81 fb 00 f0 ff ff 77 3c e8 8c 7b 78 fc ba 02 00 00 00 48 89 de 31 ff <48> 8b 83 d8 00 00 00 0f b6 28 e8 83 74 87 ff e8 6e 7b 78 fc 89 e8
[ 49.892482][ T5134] RSP: 0018:ffffc9000c087d58 EFLAGS: 00010246
[ 49.898531][ T5134] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff84e919d6
[ 49.906576][ T5134] RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
[ 49.914714][ T5134] RBP: 0000000000000c03 R08: 0000000000000007 R09: fffffffffffff000
[ 49.922748][ T5134] R10: 0000000000000000 R11: ffff88810c72bf00 R12: 0000000000000000
[ 49.930873][ T5134] R13: ffff88810e0be000 R14: 0000000000000090 R15: 0000000000000000
[ 49.938834][ T5134] FS: 0000000000000000(0000) GS:ffff8881b26c2000(0000) knlGS:0000000000000000
[ 49.948057][ T5134] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 49.954712][ T5134] CR2: 00000000000000d8 CR3: 00000001198b4000 CR4: 00000000003526f0
[ 49.962685][ T5134] Kernel panic - not syncing: Fatal exception
[ 49.969347][ T5134] Kernel Offset: disabled
[ 49.973668][ T5134] Rebooting in 86400 seconds..

syzkaller build log:
go env (err=<nil>)
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE='auto'
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/syzkaller/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/syzkaller/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build379651147=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/syzkaller/jobs-2/linux/gopath/src/github.com/google/syzkaller/go.mod'
GOMODCACHE='/syzkaller/jobs-2/linux/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/syzkaller/jobs-2/linux/gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/syzkaller/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.4'
GOWORK=''
PKG_CONFIG='pkg-config'

git status (err=<nil>)
HEAD detached at 07e030dea
nothing to commit, working tree clean

tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Makefile:31: run command via tools/syz-env for best compatibility, see:
Makefile:32: https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env
go list -f '{{.Stale}}' -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=07e030dea6e6d9ca88b75bb3be2810f47083b328 -X github.com/google/syzkaller/prog.gitRevisionDate=20251112-115923" ./sys/syz-sysgen | grep -q false || go install -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=07e030dea6e6d9ca88b75bb3be2810f47083b328 -X github.com/google/syzkaller/prog.gitRevisionDate=20251112-115923" ./sys/syz-sysgen
make .descriptions
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Makefile:31: run command via tools/syz-env for best compatibility, see:
Makefile:32: https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env
bin/syz-sysgen
touch .descriptions
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=07e030dea6e6d9ca88b75bb3be2810f47083b328 -X github.com/google/syzkaller/prog.gitRevisionDate=20251112-115923" -o ./bin/linux_amd64/syz-execprog github.com/google/syzkaller/tools/syz-execprog
mkdir -p ./bin/linux_amd64
g++ -o ./bin/linux_amd64/syz-executor executor/executor.cc \
-m64 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -std=c++17 -I. -Iexecutor/_include -DGOOS_linux=1 -DGOARCH_amd64=1 \
-DHOSTGOOS_linux=1 -DGIT_REVISION=\"07e030dea6e6d9ca88b75bb3be2810f47083b328\"
/usr/bin/ld: /tmp/cccfp96C.o: in function `Connection::Connect(char const*, char const*)':
executor.cc:(.text._ZN10Connection7ConnectEPKcS1_[_ZN10Connection7ConnectEPKcS1_]+0x104): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
./tools/check-syzos.sh 2>/dev/null

Tested on:

commit: e7c375b1 Merge tag 'vfs-6.18-rc7.fixes' of gitolite.ke..
git tree: upstream
kernel config: https://syzkaller.appspot.com/x/.config?x=f30cc590c4f6da44
dashboard link: https://syzkaller.appspot.com/bug?extid=f098d64cc684b8dbaf65
compiler: gcc (Debian 12.2.0-14+deb12u1) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=13e18e0a580000