Go to file
Anurag Biradar ded317e9c2 src/device: Fix bluetoothd crash
DUT was trying to connect with carkit and due to some reason connection
got aborted. SDP search got error and browse request was freed but
device->browse is still pointing to freed memory. During clean up
bluez removes all device and while removing it find reference to
browse_req and it tries to free again which leads to the crash.

Assign NULL to device browse_req before freeing the browse_req.

Log:

bluetooth: src/service.c:change_state() 0xb700a650: device XX:XX:XX:XX:XX:XX
           profile a2dp-sink state changed: connecting -> disconnected (-11)
bluetooth: src/device.c:device_profile_connected()
			a2dp-sink Resource temporarily unavailable (11)
bluetooth: src/device.c:device_profile_connected() returning response to :1.300
bluetooth: src/device.c:device_browse_sdp()
bluetooth: src/device.c:browse_request_free()

--Browse req is freed but device->browse is still pointing to freed memory --

While turning OFF freeing each devices:
bluetoothd[2024]: src/adapter.c:adapter_remove()
		Removing adapter /org/bluez/hci0
bluetoothd[2024]: src/device.c:device_remove()
		Removing device /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX
bluetoothd[2024]: src/device.c:browse_request_cancel()

(gdb)
0  0xb6f981ae in queue_remove_if (queue=0xb7007d70,
     function=0xb6f9a319 <match_disconn_id>, user_data=0xb7001ae0)
     at src/shared/queue.c:289
1  0xb6f9a87a in bt_att_unregister_disconnect (att=<optimized out>,
     id=<optimized out>) at src/shared/att.c:1161
2  0xb6f81bf6 in attio_cleanup (device=0xb6d4d810) at src/device.c:742
3  0xb6f81c3c in browse_request_cancel (req=0xb6fe3038) at src/device.c:777
4  0xb6f87066 in device_remove (device=0xb700ac00, remove_stored=0)
     at src/device.c:5238
5  0xb6f6b80c in adapter_remove (adapter=adapter@entry=0xb6fff2f0)
     at src/adapter.c:7822
6  0xb6f79068 in adapter_cleanup () at src/adapter.c:11707
2017-07-07 10:01:42 +03:00
android input/hog-lib: Add support to gatt-db 2016-12-29 15:17:25 +02:00
attrib shared/att: Add ext_signed flag to be able to use external crypto 2015-05-19 16:42:43 +02:00
btio btio: Use local libbluetooth includes 2015-02-28 22:29:12 -08:00
client client: Add release-notify command 2017-07-05 14:27:40 +03:00
doc client: Add release-notify command 2017-07-05 14:27:40 +03:00
emulator emulator: Update emulated controller HCI version from 4.2 to 5.0 2017-05-09 17:27:51 +03:00
gdbus gdbus: Fix the ordering of signals 2016-05-04 17:50:28 +03:00
gobex gobex: Make g_obex_apparam_encode NULL safe 2017-04-23 23:12:34 +03:00
lib lib: Add version number for Bluetooth 5.0 2017-01-29 21:31:33 -08:00
monitor monitor: Add missing UUID and EIR definitions 2017-06-22 23:48:28 +02:00
obexd obexd: Fix memory leak in phonebook-dummy 2017-07-07 10:01:42 +03:00
peripheral shared/gatt-client: Allow multiple ready callbacks 2017-07-04 12:30:05 +03:00
plugins policy: Fix removing reconnect flag while still connecting 2017-03-07 13:06:43 +02:00
profiles audio/avdtp: Increase timeout for Suspend request 2017-04-12 15:06:02 +03:00
src src/device: Fix bluetoothd crash 2017-07-07 10:01:42 +03:00
test test/example-gatt-server: Make test service primary 2016-09-22 10:52:34 +03:00
tools shared/gatt-client: Allow multiple ready callbacks 2017-07-04 12:30:05 +03:00
unit shared/gatt-client: Allow multiple ready callbacks 2017-07-04 12:30:05 +03:00
.gitignore tools: Add testing utility for advertising 2017-06-07 14:12:54 -07:00
.mailmap Fix name in AUTHORS 2015-05-20 23:16:30 +03:00
acinclude.m4 build: Enable -Wformat -Wformat-security in maintainer mode 2015-01-02 17:59:46 +01:00
AUTHORS AUTHORS: mention Michał's contributions 2016-09-21 20:19:28 +02:00
bootstrap Add --automake option 2006-08-18 19:41:53 +00:00
bootstrap-configure build: Enable --enable-deprecated in bootstrap-configure 2017-03-01 13:57:57 +02:00
ChangeLog Release 5.45 2017-05-04 23:05:21 +02:00
configure.ac Release 5.45 2017-05-04 23:05:21 +02:00
COPYING Remove new page characters 2008-08-14 22:56:25 +02:00
COPYING.LIB Remove new page characters 2008-08-14 22:56:25 +02:00
HACKING HACKING: Fix nit in instructions 2016-04-22 15:05:03 +03:00
INSTALL Big cleanup of CVS relics 2005-10-29 19:25:42 +00:00
Makefile.am build: Update library version 2017-02-24 19:14:45 +01:00
Makefile.obexd build: Remove unneeded includes from obexd binaries 2015-03-01 00:48:41 -08:00
Makefile.plugins profiles/midi: Added MIDI over BLE profile implementation 2017-01-04 12:05:14 +02:00
Makefile.tools client: Add acquire-notify command 2017-07-05 14:27:38 +03:00
NEWS Initial revision 2002-03-08 21:10:06 +00:00
README build: Add testing config option 2017-01-17 11:27:26 +02:00
TODO TODO: Update GATT/ATT items 2016-03-14 16:42:59 +02:00

BlueZ - Bluetooth protocol stack for Linux
******************************************

Copyright (C) 2000-2001  Qualcomm Incorporated
Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>


Compilation and installation
============================

In order to compile Bluetooth utilities you need following software packages:
	- GCC compiler
	- GLib library
	- D-Bus library
	- udev library (optional)
	- readline (command line clients)

To configure run:
	./configure --prefix=/usr --mandir=/usr/share/man \
				--sysconfdir=/etc --localstatedir=/var

Configure automatically searches for all required components and packages.

To compile and install run:
	make && make install


Configuration and options
=========================

For a working system, certain configuration options need to be enabled:

	--enable-library

		Enable installation of Bluetooth library

		By default the Bluetooth library is no longer installed.

		The user interfaces or command line utilities do not
		require an installed Bluetooth library anymore. This
		option is provided for legacy third party applications
		that still depend on the library.

		When the library installation is enabled, it is a good
		idea to use a separate bluez-library or libbluetooth
		package for it.

	--disable-tools

		Disable support for Bluetooth utilities

		By default the Bluetooth utilities are built and also
		installed. For production systems the tools are not
		needed and this option allows to disable them to save
		build time and disk space.

		When the tools are selected, it is a good idea to
		use a separate bluez-tools package for them.

	--disable-cups

		Disable support for CUPS printer backend

		By default the printer backend for CUPS is build and
		also installed. For systems that do not require printing
		over Bluetooth, this options allows to disable it.

		When the CUPS backend is selected, it is a good idea to
		use a separate bluez-cups package for it.

	--disable-monitor

		Disable support for the Bluetooth monitor utility

		By default the monitor utility is enabled. It provides
		support for HCI level tracing and debugging. For systems
		that don't require any kind of tracing or debugging
		capabilities, this options allows to disable it.

		The monitor utility should be placed in the main package
		along with the daemons. It is universally useful.

	--disable-client

		Disable support for the command line client

		By default the command line client is enabled and uses the
		readline library. For specific systems where BlueZ is
		configured by other means, the command line client can be
		disabled and the dependency on readline is removed.

		The client should be placed in the main package along
		with the daemons. It is universally useful.

	--disable-systemd

		Disable integration with systemd

		By default the integration with systemd is enabled and
		installed. This gives the best integration into all
		distributions based on systemd.

		This option is provided for distributions that do not
		support systemd. In that case all integration with the
		init system is up to the package.

	--disable-a2dp

		Disable A2DP profile

		By default bluetoothd supports A2DP profile using a built-in
		plugin, this option disables it.

		This option is provided for distributions that do not have any
		audio capabilities.

	--disable-avrcp

		Disable AVRCP profile

		By default bluetoothd supports AVRCP profile using a built-in
		plugin, this option disables it.

		This option is provided for distributions that do not have any
		audio capabilities.

	--disable-network

		Disable PANU, NAP, GN profiles

		By default bluetoothd supports PANU, NAP and GN profile using a
		built-in plugin, this option disables it.

		This option is provided for distributions that do not have any
		network capabilities.

	--disable-hid

		Disable HID profile

		By default bluetoothd supports HID profile using a built-in
		plugin, this option disables it.

		This option is provided for distributions that do not have any
		input capabilities.

	--disable-hog

		Disable HoG profile

		By default bluetoothd supports HoG profile using a built-in
		plugin, this option disables it.

		This option is provided for distributions that do not have any
		input capabilities.

	--enable-testing

		Enable testing tools

		By default tools used only for testing emulation are disabled.
		This option can be used to enable them.

		It is not recommended to enable this option for production
		systems. These tools may contain tests that depend on specific
		environment or kernel features in development.

	--enable-experimental

		Enable experimental tools

		By default all tools that are still in development
		are disabled. This option can be used to enable them.

		It is not recommended to enable this option for production
		systems. The behavior of the experimental tools is unstable
		and might still change.

	--enable-deprecated

		Enable deprecated tools

		By defauld all tools that are no longer maintained are
		disabled. This option can be used to enable them.

		It is not recommended to enable this option for production
		systems. The behavior of the deprecated tools may be unstable
		or simply don't work anymore.

	--enable-nfc

		This option enable NFC pairing support.

		By default the integration with neard is disabled, this gives
		the option to enable it in system where neard is supported.

		The plugin is built into bluetoothd therefore it does not need
		to be package separately.

	--enable-sap

		This option enable SAP profile using sap plugin.

		By default sap plugin is disabled since it requires tight
		integration with systems and is very rarely required.

		The plugin is built into bluetoothd therefore it does not need
		to be package separately.

	--enable-health

		This option enable health profiles.

		By default health plugin is disabled since its profiles are
		target for the health industry.

		The plugin is built into bluetoothd therefore it does not need
		to be package separately.

	--enable-midi

		This option enable MIDI support via ALSA Sequencer.

		By default midi plugin is disabled since it still considered
		experimental. When bluetoothd will create a new ALSA Sequencer
		client and port for each device connected that supports the
		MIDI GATT primary service.

		The plugin is built into bluetoothd therefore it does not need
		to be package separately.

Information
===========

Mailing lists:
	linux-bluetooth@vger.kernel.org

For additional information about the project visit BlueZ web site:
	http://www.bluez.org