From fc1af149d599281bb679fd352cdefddb86374f86 Mon Sep 17 00:00:00 2001 From: spycat88 Date: Wed, 30 Jul 2025 20:51:55 +0100 Subject: [PATCH] bluez: bump package --- .../ROCKNIX/packages/network/bluez/package.mk | 2 +- .../patches/bluez-01_add-obexd-policy.patch | 2 +- .../bluez-02_obexd-use-system-bus.patch | 25 -- .../bluez-04-valve-bluetooth-config.patch | 24 -- .../bluez-05-valve-bluetooth-phy.patch | 246 ------------------ .../patches/bluez-07-trust-sixaxis.patch | 14 - ...ixaxis-fix-PID-navigation-controller.patch | 21 +- .../bluez-12-fix-obexd-after-5_73.patch | 16 +- .../bluez-22-Revert-build-Fix-distcheck.patch | 50 ---- ...crash-if-bt_uhid_destroy-free-replay.patch | 45 ---- 10 files changed, 22 insertions(+), 423 deletions(-) delete mode 100644 projects/ROCKNIX/packages/network/bluez/patches/bluez-02_obexd-use-system-bus.patch delete mode 100644 projects/ROCKNIX/packages/network/bluez/patches/bluez-04-valve-bluetooth-config.patch delete mode 100644 projects/ROCKNIX/packages/network/bluez/patches/bluez-05-valve-bluetooth-phy.patch delete mode 100644 projects/ROCKNIX/packages/network/bluez/patches/bluez-07-trust-sixaxis.patch delete mode 100644 projects/ROCKNIX/packages/network/bluez/patches/bluez-22-Revert-build-Fix-distcheck.patch delete mode 100644 projects/ROCKNIX/packages/network/bluez/patches/bluez-50-shared-uhid--Fix-crash-if-bt_uhid_destroy-free-replay.patch diff --git a/projects/ROCKNIX/packages/network/bluez/package.mk b/projects/ROCKNIX/packages/network/bluez/package.mk index 23a7f584ce..786baa6c5e 100644 --- a/projects/ROCKNIX/packages/network/bluez/package.mk +++ b/projects/ROCKNIX/packages/network/bluez/package.mk @@ -3,7 +3,7 @@ # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) PKG_NAME="bluez" -PKG_VERSION="5.75" +PKG_VERSION="5.83" PKG_LICENSE="GPL" PKG_SITE="http://www.bluez.org/" PKG_URL="https://www.kernel.org/pub/linux/bluetooth/${PKG_NAME}-${PKG_VERSION}.tar.xz" diff --git a/projects/ROCKNIX/packages/network/bluez/patches/bluez-01_add-obexd-policy.patch b/projects/ROCKNIX/packages/network/bluez/patches/bluez-01_add-obexd-policy.patch index 1517d65a3d..6fd94b998e 100644 --- a/projects/ROCKNIX/packages/network/bluez/patches/bluez-01_add-obexd-policy.patch +++ b/projects/ROCKNIX/packages/network/bluez/patches/bluez-01_add-obexd-policy.patch @@ -2,7 +2,7 @@ diff --git a/src/bluetooth.conf b/src/bluetooth.conf index 8a1e258..31b7542 100644 --- a/src/bluetooth.conf +++ b/src/bluetooth.conf -@@ -20,10 +20,24 @@ +@@ -21,10 +21,24 @@ diff --git a/projects/ROCKNIX/packages/network/bluez/patches/bluez-02_obexd-use-system-bus.patch b/projects/ROCKNIX/packages/network/bluez/patches/bluez-02_obexd-use-system-bus.patch deleted file mode 100644 index dd52a299ea..0000000000 --- a/projects/ROCKNIX/packages/network/bluez/patches/bluez-02_obexd-use-system-bus.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 20dfa1079c088236bcd63f1a986956b488177ebf Mon Sep 17 00:00:00 2001 -From: Stefan Saraev -Date: Tue, 6 Aug 2013 11:18:09 +0300 -Subject: [PATCH] obexd: use system bus - ---- - obexd/src/manager.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/obexd/src/manager.c b/obexd/src/manager.c -index dbfbef8..9a29f8c 100644 ---- a/obexd/src/manager.c -+++ b/obexd/src/manager.c -@@ -569,7 +569,7 @@ gboolean manager_init(void) - - dbus_error_init(&err); - -- connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OBEXD_SERVICE, &err); -+ connection = g_dbus_setup_bus(DBUS_BUS_SYSTEM, OBEXD_SERVICE, &err); - if (connection == NULL) { - if (dbus_error_is_set(&err) == TRUE) { - fprintf(stderr, "%s\n", err.message); --- -1.7.2.5 - diff --git a/projects/ROCKNIX/packages/network/bluez/patches/bluez-04-valve-bluetooth-config.patch b/projects/ROCKNIX/packages/network/bluez/patches/bluez-04-valve-bluetooth-config.patch deleted file mode 100644 index ba22408ca8..0000000000 --- a/projects/ROCKNIX/packages/network/bluez/patches/bluez-04-valve-bluetooth-config.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/src/main.conf b/src/main.conf -index 2796f155e..f7b032b9f 100644 ---- a/src/main.conf -+++ b/src/main.conf -@@ -60,7 +60,7 @@ - # or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple - # Devices (MPMD) configurations. - # Possible values: "off", "single", "multiple" --#MultiProfile = off -+MultiProfile = multiple - - # Permanently enables the Fast Connectable setting for adapters that - # support it. When enabled other devices can connect faster to us, -@@ -182,8 +182,8 @@ - - # LE scanning parameters used for passive scanning supporting wake from suspend - # scenarios --#ScanIntervalSuspend= --#ScanWindowSuspend= -+ScanIntervalSuspend=2240 -+ScanWindowSuspend=224 - - # LE scanning parameters used for active scanning supporting discovery - # proceedure diff --git a/projects/ROCKNIX/packages/network/bluez/patches/bluez-05-valve-bluetooth-phy.patch b/projects/ROCKNIX/packages/network/bluez/patches/bluez-05-valve-bluetooth-phy.patch deleted file mode 100644 index d9552a9f19..0000000000 --- a/projects/ROCKNIX/packages/network/bluez/patches/bluez-05-valve-bluetooth-phy.patch +++ /dev/null @@ -1,246 +0,0 @@ -From d1ef0be0d84b909a88dccf28af52d5a1c0e49992 Mon Sep 17 00:00:00 2001 -From: Vicki Pfau -Date: Fri, 8 Sep 2023 16:53:02 -0700 -Subject: [PATCH 2/2] Experimental patch to enable alternate Bluetooth - connection modes - -This should improve Bluetooth connectivity, especially with multiple controllers and while docked. - -Testing: -sudo btmgmt -[mgmt]# phy -Verify that LE2MRX, LE2MTX, LECODEDRX, LECODEDTX are in the selected phys list. -Verify that multiple controllers can connect and work well. - -Co-Authored-By: Rachel Blackman ---- - src/adapter.c | 46 ++++++++++++++++++++++++++++ - src/btd.h | 2 ++ - src/main.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ - src/main.conf | 5 +++ - 4 files changed, 138 insertions(+) - -diff --git a/src/adapter.c b/src/adapter.c -index 5ebfc4752..bc1e1d418 100644 ---- a/src/adapter.c -+++ b/src/adapter.c -@@ -86,6 +86,18 @@ - #define DISTANCE_VAL_INVALID 0x7FFF - #define PATHLOSS_MAX 137 - -+#define LE_PHY_1M 0x01 -+#define LE_PHY_2M 0x02 -+#define LE_PHY_CODED 0x04 -+ -+#define PHYVAL_REQUIRED 0x07ff -+#define PHYVAL_1M_TX (1<<9) -+#define PHYVAL_1M_RX (1<<10) -+#define PHYVAL_2M_TX (1<<11) -+#define PHYVAL_2M_RX (1<<12) -+#define PHYVAL_CODED_TX (1<<13) -+#define PHYVAL_CODED_RX (1<<14) -+ - /* - * These are known security keys that have been compromised. - * If this grows or there are needs to be platform specific, it is -@@ -844,6 +856,36 @@ static bool set_discoverable(struct btd_adapter *adapter, uint8_t mode, - return false; - } - -+static void set_phy_support_complete(uint8_t status, uint16_t length, -+ const void *param, void *user_data) -+{ -+ if (status != 0) { -+ struct btd_adapter *adapter = (struct btd_adapter *)user_data; -+ -+ btd_error(adapter->dev_id, "PHY setting rejected for %u: %s", -+ adapter->dev_id, mgmt_errstr(status)); -+ } -+} -+ -+static bool set_phy_support(struct btd_adapter *adapter, uint32_t phy_mask) -+{ -+ struct mgmt_cp_set_phy_confguration cp; -+ -+ memset(&cp, 0, sizeof(cp)); -+ cp.selected_phys = cpu_to_le32(phy_mask | PHYVAL_REQUIRED); -+ -+ if (mgmt_send(adapter->mgmt, MGMT_OP_SET_PHY_CONFIGURATION, -+ adapter->dev_id, sizeof(cp), &cp, -+ set_phy_support_complete, (void*)adapter, NULL) > 0) -+ return true; -+ -+ btd_error(adapter->dev_id, "Failed to set PHY for index %u", -+ adapter->dev_id); -+ -+ return false; -+ -+} -+ - static bool pairable_timeout_handler(gpointer user_data) - { - struct btd_adapter *adapter = user_data; -@@ -10387,6 +10429,10 @@ static void read_info_complete(uint8_t status, uint16_t length, - if (btd_adapter_get_powered(adapter)) - adapter_start(adapter); - -+ // Some adapters do not want to accept this before being started/powered. -+ if (btd_opts.phys > 0) -+ set_phy_support(adapter, btd_opts.phys); -+ - return; - - failed: -diff --git a/src/btd.h b/src/btd.h -index b7e7ebd61..2b84f7a51 100644 ---- a/src/btd.h -+++ b/src/btd.h -@@ -151,6 +151,8 @@ struct btd_opts { - struct btd_advmon_opts advmon; - - struct btd_csis csis; -+ -+ uint32_t phys; - }; - - extern struct btd_opts btd_opts; -diff --git a/src/main.c b/src/main.c -index 2134fcf75..700c83c78 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -127,6 +127,7 @@ static const char *le_options[] = { - "AdvMonAllowlistScanDuration", - "AdvMonNoFilterScanDuration", - "EnableAdvMonInterleaveScan", -+ "SupportedPHYs", - NULL - }; - -@@ -180,10 +181,32 @@ static const struct group_table { - { } - }; - -+static const char *conf_phys_str[] = { -+ "BR1M1SLOT", -+ "BR1M3SLOT", -+ "BR1M5SLOT", -+ "EDR2M1SLOT", -+ "EDR2M3SLOT", -+ "EDR2M5SLOT", -+ "EDR3M1SLOT", -+ "EDR3M3SLOT", -+ "EDR3M5SLOT", -+ "LE1MTX", -+ "LE1MRX", -+ "LE2MTX", -+ "LE2MRX", -+ "LECODEDTX", -+ "LECODEDRX", -+}; -+ - #ifndef MIN - #define MIN(x, y) ((x) < (y) ? (x) : (y)) - #endif - -+#ifndef NELEM -+#define NELEM(x) (sizeof(x) / sizeof((x)[0])) -+#endif -+ - static int8_t check_sirk_alpha_numeric(char *str) - { - int8_t val = 0; -@@ -224,6 +247,54 @@ static size_t hex2bin(const char *hexstr, uint8_t *buf, size_t buflen) - return len; - } - -+static const char *conf_phys2str(uint32_t phys) -+{ -+ static char str[256]; -+ unsigned int i; -+ int off; -+ -+ off = 0; -+ str[0] = '\0'; -+ -+ for (i = 0; i < NELEM(conf_phys_str); i++) { -+ if ((phys & (1 << i)) != 0) -+ off += snprintf(str + off, sizeof(str) - off, "%s ", -+ conf_phys_str[i]); -+ } -+ -+ return str; -+} -+ -+static bool str2phy(const char *phy_str, uint32_t *phy_val) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < NELEM(conf_phys_str); i++) { -+ if (strcasecmp(conf_phys_str[i], phy_str) == 0) { -+ *phy_val = (1 << i); -+ return true; -+ } -+ } -+ -+ return false; -+} -+ -+static void btd_parse_phy_list(char **list) -+{ -+ uint32_t phys = 0; -+ -+ for (int i = 0; list[i]; i++) { -+ uint32_t phy_val; -+ -+ info("Enabling PHY option: %s", list[i]); -+ -+ if (str2phy(list[i], &phy_val)) -+ phys |= phy_val; -+ } -+ -+ btd_opts.phys = phys; -+} -+ - GKeyFile *btd_get_main_conf(void) - { - return main_conf; -@@ -674,6 +745,20 @@ static void parse_le_config(GKeyFile *config) - return; - - parse_mode_config(config, "LE", params, ARRAY_SIZE(params)); -+ -+ char **strlist; -+ GError *err = NULL; -+ strlist = g_key_file_get_string_list(config, "LE", -+ "SupportedPHYs", -+ NULL, &err); -+ if (err) { -+ DBG("%s", err->message); -+ g_clear_error(&err); -+ } -+ else { -+ btd_parse_phy_list(strlist); -+ g_strfreev(strlist); -+ } - } - - static bool match_experimental(const void *data, const void *match_data) -diff --git a/src/main.conf b/src/main.conf -index cb9b241df..c086a17d0 100644 ---- a/src/main.conf -+++ b/src/main.conf -@@ -231,6 +231,11 @@ MultiProfile = multiple - # Defaults to 1 - #EnableAdvMonInterleaveScan= - -+# Which Bluetooth LE PHYs should be enabled/supported? -+# Options are LE1MTX LE1MRX LE2MTX LE2MRX LECODEDTX LECODEDRX -+# Defaults to LE1MTX,LE1MRX -+SupportedPHYs=LE1MTX,LE1MRX,LE2MTX,LE2MRX,LECODEDTX,LECODEDRX -+ - [GATT] - # GATT attribute cache. - # Possible values: --- -2.41.0 - diff --git a/projects/ROCKNIX/packages/network/bluez/patches/bluez-07-trust-sixaxis.patch b/projects/ROCKNIX/packages/network/bluez/patches/bluez-07-trust-sixaxis.patch deleted file mode 100644 index b63fd12978..0000000000 --- a/projects/ROCKNIX/packages/network/bluez/patches/bluez-07-trust-sixaxis.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c.new -index 544ab399ad..b68b0f46fb 100644 ---- a/plugins/sixaxis.c -+++ b/plugins/sixaxis.c.new -@@ -350,7 +350,8 @@ static bool setup_device(int fd, const char *sysfs_path, - - btd_device_device_set_name(device, cp->name); - btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version); -- btd_device_set_temporary(device, true); -+ btd_device_set_temporary(device, false); -+ btd_device_set_trusted(device, true); - - closure = g_new0(struct authentication_closure, 1); - if (!closure) { diff --git a/projects/ROCKNIX/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch b/projects/ROCKNIX/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch index bb7e84e1dc..d3de493f2e 100644 --- a/projects/ROCKNIX/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch +++ b/projects/ROCKNIX/packages/network/bluez/patches/bluez-11_sixaxis-fix-PID-navigation-controller.patch @@ -9,28 +9,31 @@ Date: 2015-06-15 18:28:26 GMT (36 weeks, 4 days, 21 hours and 32 minutes ago) Navigation Controller is using PID 0x042f over USB but PID 0x0268 (same as Dualshock 3) over BT. --- - plugins/sixaxis.c | 5 +++++ + plugins/sixaxis.c | 8 +++++++- profiles/input/sixaxis.h | 2 ++ - 2 files changed, 7 insertions(+) + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c -index 1653491..6330001 100644 +index 939fed7..f6baea7 100644 --- a/plugins/sixaxis.c +++ b/plugins/sixaxis.c -@@ -350,6 +350,11 @@ static bool setup_device(int fd, const char *sysfs_path, +@@ -354,7 +354,13 @@ static bool setup_device(int fd, const char *sysfs_path, + info("sixaxis: setting up new device"); btd_device_device_set_name(device, cp->name); - btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version); +- btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version); ++ + /* if device reports different pid/vid on BT prefer those over USB */ + if (cp->bt_pid) + btd_device_set_pnpid(device, cp->source, cp->vid, cp->bt_pid, cp->version); + else + btd_device_set_pnpid(device, cp->source, cp->vid, cp->pid, cp->version); - btd_device_set_temporary(device, false); - btd_device_set_trusted(device, true); ++ + btd_device_set_temporary(device, true); + closure = g_new0(struct authentication_closure, 1); diff --git a/profiles/input/sixaxis.h b/profiles/input/sixaxis.h -index ab88319..0fe3732 100644 +index 8e6f3cc..321a918 100644 --- a/profiles/input/sixaxis.h +++ b/profiles/input/sixaxis.h @@ -25,6 +25,7 @@ struct cable_pairing { @@ -41,7 +44,7 @@ index ab88319..0fe3732 100644 CablePairingType type; }; -@@ -54,6 +55,7 @@ get_pairing(uint16_t vid, uint16_t pid, const char *name) +@@ -54,6 +55,7 @@ get_pairing(uint16_t vid, uint16_t pid) .vid = 0x054c, .pid = 0x042f, .version = 0x0000, diff --git a/projects/ROCKNIX/packages/network/bluez/patches/bluez-12-fix-obexd-after-5_73.patch b/projects/ROCKNIX/packages/network/bluez/patches/bluez-12-fix-obexd-after-5_73.patch index 8b2e0e52fa..4023c97bd5 100644 --- a/projects/ROCKNIX/packages/network/bluez/patches/bluez-12-fix-obexd-after-5_73.patch +++ b/projects/ROCKNIX/packages/network/bluez/patches/bluez-12-fix-obexd-after-5_73.patch @@ -7,9 +7,9 @@ index b7e9f2d33..9a9e9a0a0 100644 -if OBEX - if SYSTEMD - systemduserunitdir = $(SYSTEMD_USERUNITDIR) - systemduserunit_DATA = obexd/src/obex.service -@@ -41,6 +39,8 @@ obexd_builtin_sources += obexd/plugins/opp.c + systemduserunit_DATA += obexd/src/obex.service + +@@ -40,6 +38,8 @@ obexd_builtin_sources += obexd/plugins/opp.c obexd_builtin_modules += ftp obexd_builtin_sources += obexd/plugins/ftp.c obexd/plugins/ftp.h @@ -18,7 +18,7 @@ index b7e9f2d33..9a9e9a0a0 100644 obexd_builtin_modules += irmc obexd_builtin_sources += obexd/plugins/irmc.c -@@ -57,6 +57,8 @@ obexd_builtin_sources += obexd/plugins/mas.c obexd/src/map_ap.h \ +@@ -56,6 +56,8 @@ obexd_builtin_sources += obexd/plugins/mas.c obexd/src/map_ap.h \ obexd/plugins/messages.h \ obexd/plugins/messages-dummy.c @@ -27,7 +27,7 @@ index b7e9f2d33..9a9e9a0a0 100644 obexd_builtin_modules += mns obexd_builtin_sources += obexd/client/mns.c obexd/src/map_ap.h \ obexd/client/map-event.h -@@ -103,11 +105,6 @@ obexd_src_obexd_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \ +@@ -107,11 +109,6 @@ obexd_src_obexd_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) $(DBUS_CFLAGS) \ -D_FILE_OFFSET_BITS=64 \ -I$(builddir)/obexd/src @@ -36,6 +36,6 @@ index b7e9f2d33..9a9e9a0a0 100644 -obexd-remove-service-symlink: -endif - - obexd_src_obexd_SHORTNAME = obexd - - obexd_builtin_files = obexd/src/builtin.h $(obexd_builtin_nodist) + if OBEX + if SYSTEMD + obexd_src_obexd_CPPFLAGS += -DSYSTEMD diff --git a/projects/ROCKNIX/packages/network/bluez/patches/bluez-22-Revert-build-Fix-distcheck.patch b/projects/ROCKNIX/packages/network/bluez/patches/bluez-22-Revert-build-Fix-distcheck.patch deleted file mode 100644 index 532a16701f..0000000000 --- a/projects/ROCKNIX/packages/network/bluez/patches/bluez-22-Revert-build-Fix-distcheck.patch +++ /dev/null @@ -1,50 +0,0 @@ -From e679b29bcf4890d61294e4110bace5f783632e5a Mon Sep 17 00:00:00 2001 -From: Rudi Heitbaum -Date: Sat, 9 Mar 2024 08:55:24 +0000 -Subject: [PATCH] Revert "build: Fix distcheck" - -This reverts commit d5a9195a6269e703c6e3a47c40982ec94d8cc838. ---- - Makefile.tools | 6 +----- - configure.ac | 8 +------- - 2 files changed, 2 insertions(+), 12 deletions(-) - -diff --git a/Makefile.tools b/Makefile.tools -index 27a753762..c17244677 100644 ---- a/Makefile.tools -+++ b/Makefile.tools -@@ -539,11 +539,7 @@ endif - - if CUPS - --if CUPS_SERVERBIN --cupsdir = $(CUPS_SERVERBIN)/backend --else --cupsdir = $(libdir)/cups/backend --endif -+cupsdir = $(CUPSDIR) - - cups_PROGRAMS = profiles/cups/bluetooth - -diff --git a/configure.ac b/configure.ac -index 9ebc250cf..0190e8271 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -247,13 +247,7 @@ AC_ARG_ENABLE(cups, AS_HELP_STRING([--disable-cups], - [disable CUPS printer support]), [enable_cups=${enableval}]) - AM_CONDITIONAL(CUPS, test "${enable_cups}" != "no") - if (test "${enable_cups}" != "no"); then -- AC_MSG_CHECKING([cups directory]) -- cups_serverbin=`$PKG_CONFIG cups --variable=cups_serverbin` -- AM_CONDITIONAL(CUPS_SERVERBIN, test "${cups_serverbin}" != "") -- if (test "${cups_serverbin}" != ""); then -- AC_SUBST(CUPS_SERVERBIN, ${cups_serverbin}) -- fi -- AC_MSG_RESULT([${cups_serverbin}]) -+ AC_SUBST(CUPSDIR, `$PKG_CONFIG cups --variable=cups_serverbin`/backend) - fi - - AC_ARG_ENABLE(mesh, AS_HELP_STRING([--enable-mesh], --- -2.43.0 - diff --git a/projects/ROCKNIX/packages/network/bluez/patches/bluez-50-shared-uhid--Fix-crash-if-bt_uhid_destroy-free-replay.patch b/projects/ROCKNIX/packages/network/bluez/patches/bluez-50-shared-uhid--Fix-crash-if-bt_uhid_destroy-free-replay.patch deleted file mode 100644 index 129c7b0456..0000000000 --- a/projects/ROCKNIX/packages/network/bluez/patches/bluez-50-shared-uhid--Fix-crash-if-bt_uhid_destroy-free-replay.patch +++ /dev/null @@ -1,45 +0,0 @@ -From b94f1be656f34ea1363f5566ef63b847234c6dea Mon Sep 17 00:00:00 2001 -From: Luiz Augusto von Dentz -Date: Mon, 15 Apr 2024 10:48:58 -0400 -Subject: [PATCH] shared/uhid: Fix crash if bt_uhid_destroy free replay - structure - -Id replay structured has been allocated it shall be set back to NULL -after calling uhid_replay_free otherwise it may cause the following -crash: - -Invalid read of size 1 - at 0x1D8FC4: bt_uhid_record (uhid.c:116) - by 0x1D912C: uhid_read_handler (uhid.c:158) - by 0x201A64: watch_callback (io-glib.c:157) - by 0x48D4198: g_main_dispatch.lto_priv.0 (gmain.c:3344) - by 0x49333BE: UnknownInlinedFun (gmain.c:4152) - by 0x49333BE: g_main_context_iterate_unlocked.isra.0 (gmain.c:4217) - by 0x48D4DC6: g_main_loop_run (gmain.c:4419) - by 0x2020F4: mainloop_run (mainloop-glib.c:66) - by 0x20254B: mainloop_run_with_signal (mainloop-notify.c:188) - by 0x12D6D4: main (main.c:1456) - Address 0x53ae9c0 is 0 bytes inside a block of size 40 free'd - at 0x48468CF: free (vg_replace_malloc.c:985) - by 0x1D8E19: uhid_replay_free (uhid.c:68) - by 0x1D8E19: uhid_replay_free (uhid.c:59) - by 0x1D8E19: bt_uhid_destroy (uhid.c:509) - by 0x1591F5: uhid_disconnect (device.c:183) - -Fixes: https://github.com/bluez/bluez/issues/815 ---- - src/shared/uhid.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/shared/uhid.c b/src/shared/uhid.c -index c1092b707..1f071b958 100644 ---- a/src/shared/uhid.c -+++ b/src/shared/uhid.c -@@ -507,6 +507,7 @@ int bt_uhid_destroy(struct bt_uhid *uhid) - - uhid->created = false; - uhid_replay_free(uhid->replay); -+ uhid->replay = NULL; - - return err; - }