From 7b50fb3a0619f1924a130736aa894b8462eb1187 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Fri, 27 Sep 2024 14:09:23 +0200 Subject: [PATCH] bluetooth-init: ensure the interface is up before unloading the module This is a workaround for a driver failure when unloading the module. The "btnxpuart" driver crashes with a null pointer dereference if the bluetooth interface is down when the module is unloaded. Signed-off-by: Javier Viguera --- .../bluez/bluez5-init/ccimx9/bluetooth-init | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx9/bluetooth-init b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx9/bluetooth-init index 7d4b630d9..687b8cff2 100644 --- a/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx9/bluetooth-init +++ b/meta-digi-dey/recipes-connectivity/bluez/bluez5-init/ccimx9/bluetooth-init @@ -66,8 +66,12 @@ bluetooth_start() { } bluetooth_stop() { - # Remove the kernel module - rmmod "${MODULE_NAME}" + # + # The btnxpuart driver hits a null pointer dereference on module + # unloading when the interface is down. So as a workaround, make + # sure the interface is UP before unloading the module. + # + hciconfig "${HCI_IFACE}" up && rmmod "${MODULE_NAME}" power 0 }