mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bin Luo (University of Electronic Science and Technology of China)" <luob87709@gmail.com>
To: marcel@holtmann.org, luiz.dentz@gmail.com
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] Bluetooth: 6lowpan: fix netdev teardown UAF and registration rollback GPF
Date: Mon, 30 Nov 2026 18:28:52 +0800	[thread overview]
Message-ID: <20261130102854.1553-1-luob87709@gmail.com> (raw)

This 2-patch series fixes two lifetime bugs in Bluetooth 6LoWPAN
(net/bluetooth/6lowpan.c) discovered by static call-chain audit and
reproduced live under QEMU (x86_64, KASAN + LOCKDEP, 4 vCPUs) using only
mainline hci_vhci (/dev/vhci) with zero kernel modifications:

1. Patch 1 fixes a double list_del_rcu() general protection fault in
   setup_netdev(): publishing (*dev)->list on bt_6lowpan_devices before
   lowpan_register_netdev() causes device_event(NETDEV_UNREGISTER) to
   unlink the entry on rollback (for example after an addrconf_notify /
   snmp6_register_dev failure), after which setup_netdev()'s error path
   calls list_del_rcu() a second time and faults on LIST_POISON2
   (0xdead000000000122).

2. Patch 2 fixes a slab-use-after-free write in __run_timer_base() when
   the last L2CAP IPSP peer disconnects concurrently with a new channel
   becoming ready on the same hci_dev, as well as unprotected RCU
   lookups in lookup_dev() callers (chan_ready_cb, chan_recv_cb,
   chan_suspend_cb, chan_resume_cb):

   BUG: KASAN: slab-use-after-free in __run_timer_base.part.0+0x897/0x940
   Write of size 8 at addr ffff8880046ed0e8 by task swapper/0/0
   Allocated by task 92:
    alloc_netdev_mqs+0x78/0x10c0
    chan_ready_cb+0x3cf/0xab0
   Freed by task 9:
    kfree+0x2fd/0x530
    device_release+0xc8/0x240
    kobject_put+0x14d/0x280
    netdev_run_todo+0x7a7/0x10f0
    delete_netdev+0x5b/0x80

Verification:
- scripts/checkpatch.pl --strict: 0 errors, 0 warnings, 0 checks on both patches
- W=1 KASAN+LOCKDEP build of net/bluetooth/6lowpan.o: 0 warnings, 0 errors
- QEMU KASAN+LOCKDEP hci_vhci reproducer (12 rapid connect/disconnect cycles):
  - Unpatched v7.4-rc5: KASAN slab-use-after-free write on iteration 0,
    followed by double list_del_rcu() GPF on iteration 4
  - With this series: 12/12 iterations pass with 0 KASAN, 0 GPF, 0 Lockdep,
    and 0 warnings

base-commit: 4dce97c6c265544342e716e62fd24bbb232590c5

Bin Luo (University of Electronic Science and Technology of China) (2):
  Bluetooth: 6lowpan: publish netdev after registration in
    setup_netdev()
  Bluetooth: 6lowpan: unlink closing device and protect RCU lookups

 net/bluetooth/6lowpan.c | 142 +++++++++++++++++++++++++++-------------
 1 file changed, 95 insertions(+), 47 deletions(-)

-- 
2.51.0.windows.1


             reply	other threads:[~2026-11-30 10:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 10:28 Bin Luo (University of Electronic Science and Technology of China) [this message]
2026-11-30 10:28 ` [PATCH 1/2] Bluetooth: 6lowpan: publish netdev after registration in setup_netdev() Bin Luo (University of Electronic Science and Technology of China)
2026-11-30 10:28 ` [PATCH 2/2] Bluetooth: 6lowpan: unlink closing device and protect RCU lookups Bin Luo (University of Electronic Science and Technology of China)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130102854.1553-1-luob87709@gmail.com \
    --to=luob87709@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®