Go to file
Luiz Augusto von Dentz 0e67287cac Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put
BugLink: https://bugs.launchpad.net/bugs/1989228

commit d0be8347c623e0ac4202a1d4e0373882821f56b0 upstream.

This fixes the following trace which is caused by hci_rx_work starting up
*after* the final channel reference has been put() during sock_close() but
*before* the references to the channel have been destroyed, so instead
the code now rely on kref_get_unless_zero/l2cap_chan_hold_unless_zero to
prevent referencing a channel that is about to be destroyed.

  refcount_t: increment on 0; use-after-free.
  BUG: KASAN: use-after-free in refcount_dec_and_test+0x20/0xd0
  Read of size 4 at addr ffffffc114f5bf18 by task kworker/u17:14/705

  CPU: 4 PID: 705 Comm: kworker/u17:14 Tainted: G S      W
  4.14.234-00003-g1fb6d0bd49a4-dirty #28
  Hardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150
  Google Inc. MSM sm8150 Flame DVT (DT)
  Workqueue: hci0 hci_rx_work
  Call trace:
   dump_backtrace+0x0/0x378
   show_stack+0x20/0x2c
   dump_stack+0x124/0x148
   print_address_description+0x80/0x2e8
   __kasan_report+0x168/0x188
   kasan_report+0x10/0x18
   __asan_load4+0x84/0x8c
   refcount_dec_and_test+0x20/0xd0
   l2cap_chan_put+0x48/0x12c
   l2cap_recv_frame+0x4770/0x6550
   l2cap_recv_acldata+0x44c/0x7a4
   hci_acldata_packet+0x100/0x188
   hci_rx_work+0x178/0x23c
   process_one_work+0x35c/0x95c
   worker_thread+0x4cc/0x960
   kthread+0x1a8/0x1c4
   ret_from_fork+0x10/0x18

Cc: stable@kernel.org
Reported-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tested-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2022-09-16 11:00:06 +02:00
Documentation ipv4: Fix data-races around sysctl_ip_dynaddr. 2022-09-16 10:59:21 +02:00
LICENSES
arch x86: drop bogus "cc" clobber from __try_cmpxchg_user_asm() 2022-09-16 11:00:05 +02:00
block block: fix bio_clone_blkg_association() to associate with proper blkcg_gq 2022-08-26 11:08:45 +02:00
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist 2022-08-26 11:10:49 +02:00
crypto crypto: drbg - make reseeding from get_random_bytes() synchronous 2022-08-26 11:10:37 +02:00
debian UBUNTU: debian/dkms-versions -- update from kernel-versions (main/2022.07.11) 2022-07-11 16:53:04 +02:00
debian.master UBUNTU: Upstream stable to v5.4.208 2022-09-16 11:00:06 +02:00
drivers tty: use new tty_insert_flip_string_and_push_buffer() in pty_write() 2022-09-16 11:00:05 +02:00
fs dlm: fix pending remove if msg allocation fails 2022-09-16 10:59:55 +02:00
include Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put 2022-09-16 11:00:06 +02:00
init random: handle latent entropy and command line from random_init() 2022-08-26 11:10:31 +02:00
ipc ipc/mqueue: use get_tree_nodev() in mqueue_get_tree() 2022-08-26 11:08:10 +02:00
kernel bpf: Make sure mac_header was set before using it 2022-09-16 10:59:55 +02:00
lib locking/refcount: Consolidate implementations of refcount_t 2022-09-16 10:59:59 +02:00
mm mm/mempolicy: fix uninit-value in mpol_rebind_policy() 2022-09-16 10:59:55 +02:00
net Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put 2022-09-16 11:00:06 +02:00
samples
scripts modpost: fix section mismatch check for exported init/exit sections 2022-08-26 11:11:23 +02:00
security ima: remove the IMA_TEMPLATE Kconfig option 2022-09-16 10:59:56 +02:00
sound ALSA: memalloc: Align buffer allocations in page size 2022-09-16 11:00:01 +02:00
tools selftests: forwarding: fix error message in learning_test 2022-09-16 10:59:02 +02:00
ubuntu
usr
virt KVM: Prevent module exit until all VMs are freed 2022-05-20 15:19:31 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS MAINTAINERS: co-maintain random.c 2022-08-26 11:09:46 +02:00
Makefile Linux 5.4.208 2022-09-16 11:00:06 +02:00
README
Ubuntu.md
dropped.txt
snapcraft.yaml
update-dkms-versions
update-version-dkms

README

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.