No description
  • C 96.9%
  • Assembly 0.9%
  • Rust 0.6%
  • Shell 0.6%
  • Python 0.5%
  • Other 0.3%
Find a file
Pauli Virtanen 17ef29586b Bluetooth: 6lowpan: Don't hold spin lock over sleeping functions
[ Upstream commit 98454bc812 ]

disconnect_all_peers() calls sleeping function (l2cap_chan_close) under
spinlock.  Holding the lock doesn't actually do any good -- we work on a
local copy of the list, and the lock doesn't protect against peer->chan
having already been freed.

Fix by taking refcounts of peer->chan instead.  Clean up the code and
old comments a bit.

Take devices_lock instead of RCU, because the kfree_rcu();
l2cap_chan_put(); construct in chan_close_cb() does not guarantee
peer->chan is necessarily valid in RCU.

Also take l2cap_chan_lock() which is required for l2cap_chan_close().

Log: (bluez 6lowpan-tester Client Connect - Disable)
------
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:575
...
<TASK>
...
l2cap_send_disconn_req (net/bluetooth/l2cap_core.c:938 net/bluetooth/l2cap_core.c:1495)
...
? __pfx_l2cap_chan_close (net/bluetooth/l2cap_core.c:809)
do_enable_set (net/bluetooth/6lowpan.c:1048 net/bluetooth/6lowpan.c:1068)
------

Fixes: 9030582963 ("Bluetooth: 6lowpan: Converting rwlocks to use RCU")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-12-07 06:09:27 +09:00
arch RISC-V: clear hot-unplugged cores from all task mm_cpumasks to avoid rfence errors 2025-12-07 06:09:27 +09:00
block blk-crypto: fix missing blktrace bio split events 2025-10-29 14:03:07 +01:00
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist 2022-06-22 14:22:01 +02:00
crypto crypto: essiv - Check ssize for decryption and in-place encryption 2025-10-19 16:21:43 +02:00
Documentation Revert "docs/process/howto: Replace C89 with C11" 2025-12-07 06:09:15 +09:00
drivers Bluetooth: btusb: reorder cleanup in btusb_disconnect to avoid UAF 2025-12-07 06:09:27 +09:00
fs NFS: check if suid/sgid was cleared after a write as needed 2025-12-07 06:09:27 +09:00
include compiler_types: Move unused static inline functions warning to W=2 2025-12-07 06:09:27 +09:00
init init: handle bootloader identifier in kernel parameters 2025-10-19 16:21:45 +02:00
io_uring io_uring: fix possible deadlock in io_register_iowq_max_workers() 2024-11-17 15:06:25 +01:00
ipc ipc: fix to protect IPCS lookups using RCU 2025-06-27 11:05:26 +01:00
kernel tracing: Fix memory leaks in create_field_var() 2025-12-07 06:09:26 +09:00
lib lib/crypto: curve25519-hacl64: Fix older clang KASAN workaround for GCC 2025-12-07 06:09:26 +09:00
LICENSES LICENSES/dual/CC-BY-4.0: Git rid of "smart quotes" 2021-07-15 06:31:24 -06:00
mm minmax: make generic MIN() and MAX() macros available everywhere 2025-10-19 16:21:52 +02:00
net Bluetooth: 6lowpan: Don't hold spin lock over sleeping functions 2025-12-07 06:09:27 +09:00
samples samples: mei: Fix building on musl libc 2025-08-28 16:24:07 +02:00
scripts locking: Introduce __cleanup() based infrastructure 2025-10-19 16:21:51 +02:00
security KEYS: trusted_tpm1: Compare HMAC values in constant time 2025-10-19 16:21:45 +02:00
sound ASoC: max98090/91: fixed max98091 ALSA widget powering up/down 2025-12-07 06:09:27 +09:00
tools selftests: netdevsim: set test timeout to 10 minutes 2025-12-07 06:09:26 +09:00
usr kbuild: hdrcheck: fix cross build with clang 2025-06-27 11:05:22 +01:00
virt KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin() 2024-10-22 15:40:41 +02:00
.clang-format clang-format: Update with the latest for_each macro list 2021-05-12 23:32:39 +02:00
.cocciconfig scripts: add Linux .cocciconfig for coccinelle 2016-07-22 12:13:39 +02:00
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes .gitattributes: use 'dts' diff driver for dts files 2019-12-04 19:44:11 -08:00
.gitignore Remove *.orig pattern from .gitignore 2024-10-17 15:11:10 +02:00
.mailmap mailmap: add Andrej Shadura 2021-10-18 20:22:03 -10:00
COPYING COPYING: state that all contributions really are covered by this file 2020-02-10 13:32:20 -08:00
CREDITS MAINTAINERS: Move Daniel Drake to credits 2021-09-21 08:34:58 +03:00
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y 2020-02-04 01:53:07 +09:00
Kconfig kbuild: ensure full rebuild when the compiler is updated 2020-05-12 13:28:33 +09:00
MAINTAINERS netdevsim: add Makefile for selftests 2025-12-07 06:09:25 +09:00
Makefile Linux 5.15.196 2025-10-29 14:03:16 +01:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.