NetBSD Problem Report #59392

From www@netbsd.org  Sat May  3 18:57:40 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6760B1A923C
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  3 May 2025 18:57:40 +0000 (UTC)
Message-Id: <20250503185738.DF5D51A923E@mollari.NetBSD.org>
Date: Sat,  3 May 2025 18:57:38 +0000 (UTC)
From: vezhlys@gmail.com
Reply-To: vezhlys@gmail.com
To: gnats-bugs@NetBSD.org
Subject: btsco(4): mutex_vector_enter,548: locking against myself at btsco_sco_disconnected()
X-Send-Pr-Version: www-1.0

>Number:         59392
>Category:       kern
>Synopsis:       btsco(4): mutex_vector_enter,548: locking against myself at btsco_sco_disconnected()
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 03 19:00:00 +0000 2025
>Originator:     Andrius V
>Release:        NetBSD 10.1
>Organization:
>Environment:
>Description:
On attempt to test Sony WH-CH720N bluetooth headset on NetBSD 10.1 my system crashed. I mainly repeated steps from the https://www.netbsd.org/docs/guide/en/chap-bluetooth.html#chap-bluetooth-audio-headset documentation:

added headset address to /etc/bluetooth/hosts
executed
btpin -d ubt0 -a headset -p 0000
btdevctl -d ubt0 -a headset -s HSET -A
switch to new device
audiocfg default 1
finally executed
bthset -m /dev/mixer2 -v

Unfortunately, something doesn't work well with this setup and no audio was available (also headset seemingly was still blinking led light), thus I click ctrl+c on bthset, which caused the crash:

Mutex error: mutex_vector_enter,548: locking against myself

lock address : ffffdfe0741cf2c0
current cpu  :                  0
current lwp  : 0xffffdfe072145480
owner field  : 0xffffdfe072145480 wait/spin:                0/0

panic: lock error: Mutex: mutex_vector_enter,548: locking against myself: lock 0xffffdfe0741cf2c0 cpu 0 lwp 0xffffdfe072145480
cpu0: Begin traceback...
vpanic() at netbsd:vpanic+0x183
panic() at netbsd:panic+0x3c
lockdebug_abort() at netbsd:lockdebug_abort+0x114
mutex_vector_enter() at netbsd:mutex_vector_enter+0x41b
btsco_sco_disconnected() at netbsd:btsco_sco_disconnected+0x41
hci_link_free() at netbsd:hci_link_free+0x199
hci_event() at netbsd:hci_event+0x8d7
hci_intr() at netbsd:hci_intr+0x136
softint_dispatch() at netbsd:softint_dispatch+0x3ff
DDB lost frame for netbsd:Xsoftintr+0x4c, trying 0xffffa2124b3fd0f0
Xsoftintr() at netbsd:Xsoftintr+0x4c
--- interrupt ---
fc6a3220487b346:
cpu0: End traceback...

Upon discussion it seems that bt_lock usage is not correct for btsco_sco_disconnected() 
https://nxr.netbsd.org/xref/src/sys/dev/bluetooth/btsco.c?r=1.42#454

Regards,
Andrius V


>How-To-Repeat:

>Fix:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.