Aaron Thompson
1db4564f10
Bluetooth: Remove debugfs directory on module init failure
If bt_init() fails, the debugfs directory currently is not removed. If
the module is loaded again after that, the debugfs directory is not set
up properly due to the existing directory.
# modprobe bluetooth
# ls -laF /sys/kernel/debug/bluetooth
total 0
drwxr-xr-x 2 root root 0 Sep 27 14:26 ./
drwx------ 31 root root 0 Sep 27 14:25 ../
-r--r--r-- 1 root root 0 Sep 27 14:26 l2cap
-r--r--r-- 1 root root 0 Sep 27 14:26 sco
# modprobe -r bluetooth
# ls -laF /sys/kernel/debug/bluetooth
ls: cannot access '/sys/kernel/debug/bluetooth': No such file or directory
#
# modprobe bluetooth
modprobe: ERROR: could not insert 'bluetooth': Invalid argument
# dmesg | tail -n 6
Bluetooth: Core ver 2.22
NET: Registered PF_BLUETOOTH protocol family
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: Faking l2cap_init() failure for testing
NET: Unregistered PF_BLUETOOTH protocol family
# ls -laF /sys/kernel/debug/bluetooth
total 0
drwxr-xr-x 2 root root 0 Sep 27 14:31 ./
drwx------ 31 root root 0 Sep 27 14:26 ../
#
# modprobe bluetooth
# dmesg | tail -n 7
Bluetooth: Core ver 2.22
debugfs: Directory 'bluetooth' with parent '/' already present!
NET: Registered PF_BLUETOOTH protocol family
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: L2CAP socket layer initialized
Bluetooth: SCO socket layer initialized
# ls -laF /sys/kernel/debug/bluetooth
total 0
drwxr-xr-x 2 root root 0 Sep 27 14:31 ./
drwx------ 31 root root 0 Sep 27 14:26 ../
#
Cc: stable@vger.kernel.org
Fixes: ffcecac6a7 ("Bluetooth: Create root debugfs directory during module init")
Signed-off-by: Aaron Thompson <dev@aaront.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2024-10-16 16:09:25 -04:00
..
2024-08-12 17:23:57 -07:00
2024-09-11 15:59:43 +02:00
2024-10-02 17:23:23 -04:00
2024-09-03 11:36:43 +02:00
2024-05-09 10:01:01 -07:00
2024-06-14 19:08:50 -07:00
2024-06-01 15:49:42 -07:00
2024-10-02 17:23:23 -04:00
2024-10-16 16:09:25 -04:00
2024-09-05 13:29:06 -07:00
2024-10-10 15:39:35 +02:00
2024-10-02 17:23:23 -04:00
2024-09-15 09:13:19 -07:00
2024-08-27 09:30:16 +02:00
2024-10-10 15:39:35 +02:00
2024-10-02 17:23:23 -04:00
2024-06-05 10:24:57 +01:00
2024-10-09 19:41:35 -07:00
2024-05-25 10:48:57 -07:00
2024-09-13 21:40:12 -07:00
2024-08-27 16:09:25 -07:00
2024-09-12 17:11:24 -07:00
2024-09-03 11:36:43 +02:00
2024-10-15 18:12:33 -07:00
2024-10-15 18:12:33 -07:00
2024-08-22 13:09:20 -07:00
2024-08-19 18:36:12 -07:00
2024-10-15 17:52:58 -07:00
2024-07-15 08:51:19 -07:00
2024-10-02 17:23:23 -04:00
2024-10-03 09:44:00 -07:00
2024-10-10 15:39:35 +02:00
2024-10-10 15:39:35 +02:00
2024-10-15 10:57:02 -07:00
2024-10-03 10:14:14 +02:00
2024-10-09 23:20:46 +02:00
2024-05-13 14:58:12 -07:00
2024-10-15 17:52:58 -07:00
2024-08-29 12:33:07 -07:00
2024-05-23 12:49:37 -07:00
2024-04-26 12:20:01 +02:00
2024-09-03 11:36:43 +02:00
2024-09-11 20:44:31 -07:00
2024-10-10 15:39:36 +02:00
2024-07-11 18:11:31 -07:00
2024-09-24 10:48:16 +02:00
2024-08-09 13:18:46 +01:00
2024-09-27 08:18:43 -07:00
2024-05-13 18:19:09 -06:00
2024-10-03 16:23:21 -07:00
2024-10-08 15:38:56 -07:00
2024-10-09 13:36:32 +01:00
2024-10-15 10:56:31 -07:00
2024-10-02 17:23:23 -04:00
2024-05-08 12:19:12 +01:00
2024-09-15 09:13:19 -07:00
2024-10-02 17:23:23 -04:00
2024-09-09 17:14:27 -07:00
2024-10-07 11:33:26 -07:00
2024-10-15 17:52:58 -07:00
2024-05-13 18:19:09 -06:00
2024-09-21 09:27:50 -07:00
2024-10-02 17:23:23 -04:00
2024-09-13 11:41:45 -07:00
2024-10-07 16:21:59 -07:00
2024-06-13 10:50:52 +02:00