* [PATCH BlueZ 0/1] mpris-proxy: Fix possible crash on OBEX transfer
@ 2026-11-06 8:05 Kai-Chuan Hsieh
2026-11-06 8:05 ` [PATCH BlueZ 1/1] " Kai-Chuan Hsieh
2026-11-25 9:20 ` [PATCH BlueZ 0/1] " Bastien Nocera
0 siblings, 2 replies; 10+ messages in thread
From: Kai-Chuan Hsieh @ 2026-11-06 8:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Luiz Augusto von Dentz, Bastien Nocera
This fixes a mpris-proxy crash (NULL dereference) that triggers on every
OBEX transfer, most visibly when a remote peer pushes a file to the host
over Bluetooth OBEX Object Push.
find_player_by_obex() is called from obex_property_changed() on every
Status change of any org.bluez.obex.Transfer1 object. Since the OBEX
g_dbus_client_new() client is rooted at "/", mpris-proxy proxies all of
obexd's objects, including the server-side transfer objects obexd
registers for an incoming push. Those never belong to a player, so the
list walk dereferences a NULL player->obex / session->obex and crashes.
A second, narrower crash exists in obex_get_image() when a failed
CreateSession leaves the inner proxy NULL and a Track change carries an
ImgHandle.
The affected code path (BIP cover art / find_player_by_obex) was
introduced between 5.77 and 5.80 and is still present in 5.88/master.
This change consolidates two earlier fixes that were proposed but never
merged, because the project moved off GitHub pull requests:
- PR #2098 (Bastien Nocera, "mpris-proxy: Fix possible crash"),
https://github.com/bluez/bluez/pull/2098 -- passed CI, auto-closed.
- issue #2569 / PR #2631, the additional inner-proxy (session->obex)
guard for the failed-CreateSession case,
https://github.com/bluez/bluez/issues/2569
https://github.com/bluez/bluez/pull/2631
Resending here on linux-bluetooth so it can land for the next release.
The change is confined to tools/mpris-proxy.c and only adds NULL / early-
return guards before existing dereferences, plus a g_clear_pointer()
when releasing session->obex; it adds no new dereferences.
Downstream bug report (reproducer and SRU analysis):
https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/2172906
Kai-Chuan Hsieh (1):
mpris-proxy: Fix possible crash on OBEX transfer
tools/mpris-proxy.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH BlueZ 1/1] mpris-proxy: Fix possible crash on OBEX transfer 2026-11-06 8:05 [PATCH BlueZ 0/1] mpris-proxy: Fix possible crash on OBEX transfer Kai-Chuan Hsieh @ 2026-11-06 8:05 ` Kai-Chuan Hsieh 2026-11-06 10:47 ` bluez.test.bot 2026-11-21 10:19 ` bluez.test.bot 2026-11-25 9:20 ` [PATCH BlueZ 0/1] " Bastien Nocera 1 sibling, 2 replies; 10+ messages in thread From: Kai-Chuan Hsieh @ 2026-11-06 8:05 UTC (permalink / raw) To: linux-bluetooth; +Cc: Luiz Augusto von Dentz, Bastien Nocera find_player_by_obex() and related helpers dereference player->obex and its inner ->obex proxy without checking for NULL. A player legitimately carries no OBEX session (player->obex == NULL) in three ordinary cases and stays on the players list in each: - register_player(): the remote exposes no ObexPort (no AVRCP cover art); - device_property_changed(): the device disconnected; - obex_proxy_removed(): obexd went away. find_player_by_obex() is reached from obex_property_changed() on every Status change of any org.bluez.obex.Transfer1 object. Because g_dbus_client_new() roots the OBEX client at "/", mpris-proxy proxies all of obexd's objects, including the server-side transfers obexd registers at /org/bluez/obex/server/sessionN/transferM for an incoming push. Those paths never belong to a player; walking the list faults on the first player whose session is NULL. So any peer pushing a file over OBEX crashes mpris-proxy as soon as one registered player lacks a cover-art session (the common configuration). In addition, connect_obex_session() can leave session->obex NULL after a failed CreateSession. In that state a Track change carrying an ImgHandle reaches obex_get_image(), where g_dbus_proxy_get_path(NULL) returns NULL and "path + strlen(...)" forms a garbage pointer passed to g_strconcat(), crashing the process. Guard all four player->obex / session->obex dereference sites, and use g_clear_pointer() when releasing session->obex so a stale pointer cannot be reused. This folds together the fix originally proposed by Bastien Nocera in https://github.com/bluez/bluez/pull/2098 and the additional inner-proxy guard tracked in https://github.com/bluez/bluez/issues/2569 and https://github.com/bluez/bluez/pull/2631, neither of which landed. Signed-off-by: Kai-Chuan Hsieh <kaichuan.hsieh@canonical.com> --- tools/mpris-proxy.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/mpris-proxy.c b/tools/mpris-proxy.c index e06b9ea..8547fa9 100644 --- a/tools/mpris-proxy.c +++ b/tools/mpris-proxy.c @@ -1306,7 +1306,7 @@ static int parse_track_entry(DBusMessageIter *entry, const char *key, const char *handle, *path; char *filename, *uri; - if (!player || !player->obex) + if (!player || !player->obex || !player->obex->obex) return -EINVAL; path = g_dbus_proxy_get_path(player->obex->obex); @@ -2614,9 +2614,14 @@ static void obex_get_image(struct player *player, const char *handle) DBusMessage *msg; DBusMessageIter iter, array; struct obex_session *obex_session = player->obex; - const char *path = g_dbus_proxy_get_path(obex_session->obex); + const char *path; char *filename; + if (!obex_session || !obex_session->obex) + return; + + path = g_dbus_proxy_get_path(obex_session->obex); + player->filename = g_strconcat(g_get_tmp_dir(), "/", path + strlen(BLUEZ_OBEX_CLIENT_PATH "/"), "-", handle, NULL); @@ -2674,7 +2679,7 @@ static void device_property_changed(GDBusProxy *proxy, const char *name, player->obex = NULL; } - g_dbus_proxy_unref(session->obex); + g_clear_pointer(&session->obex, g_dbus_proxy_unref); g_dbus_proxy_unref(session->device); obex_sessions = g_slist_remove(obex_sessions, session); g_free(session); @@ -2816,7 +2821,14 @@ static struct player *find_player_by_obex(const char *path) for (l = players; l; l = l->next) { struct player *player = l->data; struct obex_session *session = player->obex; - const char *obex_path = g_dbus_proxy_get_path(session->obex); + const char *obex_path; + + if (session == NULL || session->obex == NULL) + continue; + + obex_path = g_dbus_proxy_get_path(session->obex); + if (obex_path == NULL) + continue; if (g_str_has_prefix(path, obex_path)) return player; -- 2.43.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: mpris-proxy: Fix possible crash on OBEX transfer 2026-11-06 8:05 ` [PATCH BlueZ 1/1] " Kai-Chuan Hsieh @ 2026-11-06 10:47 ` bluez.test.bot 2026-11-21 10:19 ` bluez.test.bot 1 sibling, 0 replies; 10+ messages in thread From: bluez.test.bot @ 2026-11-06 10:47 UTC (permalink / raw) To: linux-bluetooth, kaichuan.hsieh [-- Attachment #1: Type: text/plain, Size: 857 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/series/1203891/ ---Test result--- Test Summary: CheckPatch PASS 0.40 seconds GitLint PASS 0.26 seconds BuildEll PASS 18.18 seconds BluezMake PASS 273.85 seconds CheckSmatch PASS 239.94 seconds bluezmakeextell PASS 89.60 seconds TestFunctional PASS 1071.05 seconds IncrementalBuild PASS 270.98 seconds ScanBuild PASS 960.31 seconds https://github.com/bluez/bluez/pull/2770 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: mpris-proxy: Fix possible crash on OBEX transfer 2026-11-06 8:05 ` [PATCH BlueZ 1/1] " Kai-Chuan Hsieh 2026-11-06 10:47 ` bluez.test.bot @ 2026-11-21 10:19 ` bluez.test.bot 1 sibling, 0 replies; 10+ messages in thread From: bluez.test.bot @ 2026-11-21 10:19 UTC (permalink / raw) To: linux-bluetooth, kaichuan.hsieh [-- Attachment #1: Type: text/plain, Size: 688 bytes --] This is an automated email and please do not reply to this email. Dear Submitter, This series was picked up by the CI more than 2 weeks ago and the pull request created for it is still open, which means the series was never applied to the tree. Series: mpris-proxy: Fix possible crash on OBEX transfer Pull Request: https://github.com/bluez/bluez/pull/2770 Created: 2026-11-06 09:57:21+00:00 The pull request has been closed and no further action is taken on this series. If the change should still be considered, it must be resent to the Linux Bluetooth mailing list (linux-bluetooth@vger.kernel.org) so that it is picked up again. --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH BlueZ 0/1] mpris-proxy: Fix possible crash on OBEX transfer 2026-11-06 8:05 [PATCH BlueZ 0/1] mpris-proxy: Fix possible crash on OBEX transfer Kai-Chuan Hsieh 2026-11-06 8:05 ` [PATCH BlueZ 1/1] " Kai-Chuan Hsieh @ 2026-11-25 9:20 ` Bastien Nocera 2026-11-26 6:47 ` [PATCH BlueZ v2 0/3] " Kai-Chuan Hsieh ` (3 more replies) 1 sibling, 4 replies; 10+ messages in thread From: Bastien Nocera @ 2026-11-25 9:20 UTC (permalink / raw) To: Kai-Chuan Hsieh, linux-bluetooth; +Cc: Luiz Augusto von Dentz On Fri, 2026-11-06 at 08:05 +0000, Kai-Chuan Hsieh wrote: > This fixes a mpris-proxy crash (NULL dereference) that triggers on > every > OBEX transfer, most visibly when a remote peer pushes a file to the > host > over Bluetooth OBEX Object Push. > > find_player_by_obex() is called from obex_property_changed() on every > Status change of any org.bluez.obex.Transfer1 object. Since the OBEX > g_dbus_client_new() client is rooted at "/", mpris-proxy proxies all > of > obexd's objects, including the server-side transfer objects obexd > registers for an incoming push. Those never belong to a player, so > the > list walk dereferences a NULL player->obex / session->obex and > crashes. > A second, narrower crash exists in obex_get_image() when a failed > CreateSession leaves the inner proxy NULL and a Track change carries > an > ImgHandle. > > The affected code path (BIP cover art / find_player_by_obex) was > introduced between 5.77 and 5.80 and is still present in 5.88/master. Regression fixes are usually annotated with: Fixes: <sha> ("commit subject") in the commit message. See: https://www.kernel.org/doc/html/v7.0/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes This makes it easier to spot mandatory fixes and when bugs were introduced. > > This change consolidates two earlier fixes that were proposed but > never > merged, because the project moved off GitHub pull requests: > > - PR #2098 (Bastien Nocera, "mpris-proxy: Fix possible crash"), > https://github.com/bluez/bluez/pull/2098 -- passed CI, auto- > closed. > - issue #2569 / PR #2631, the additional inner-proxy (session- > >obex) > guard for the failed-CreateSession case, > https://github.com/bluez/bluez/issues/2569 > https://github.com/bluez/bluez/pull/2631 > > Resending here on linux-bluetooth so it can land for the next > release. I'm not super-happy with the way this was all merged together. My original fixes had 2 separate patches, which I think should still be sent and applied separately. That would make it easier to see your actual contribution. As a matter of etiquette, it's usually fine re-sending people's patches if the patches lapsed, or even making them better and adding yourself as a "Co-Authored-by:" if the contribution was significant. In this case, it looks like my 2 patches should be re-sent, and a 3 one added to the set, is that correct? I've also mentioned on https://github.com/bluez/bluez/issues/2569 that I think the crash should be added to our own regression tests. I don't know whether there's a good place for those right now. Regards > The change is confined to tools/mpris-proxy.c and only adds NULL / > early- > return guards before existing dereferences, plus a g_clear_pointer() > when releasing session->obex; it adds no new dereferences. > > Downstream bug report (reproducer and SRU analysis): > https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/2172906 > > > Kai-Chuan Hsieh (1): > mpris-proxy: Fix possible crash on OBEX transfer > > tools/mpris-proxy.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH BlueZ v2 0/3] mpris-proxy: Fix possible crash on OBEX transfer 2026-11-25 9:20 ` [PATCH BlueZ 0/1] " Bastien Nocera @ 2026-11-26 6:47 ` Kai-Chuan Hsieh 2026-11-26 6:47 ` [PATCH BlueZ v2 1/3] mpris-proxy: Fix possible crash Kai-Chuan Hsieh ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Kai-Chuan Hsieh @ 2026-11-26 6:47 UTC (permalink / raw) To: linux-bluetooth; +Cc: hadess Hi Bastien, Sorry for the mess with the consolidated patch, and thanks for the review. Yes, your reading is correct: your two patches are re-sent here as patches 1 and 2, unmodified and with your authorship kept. Patch 3 contains what was left of my contribution after the split: the inner OBEX proxy guards for the failed-CreateSession case discussed in issue #2569. All three patches carry Fixes: 01a5a26814 ("mpris-proxy: Add mpris:artUrl support"), which introduced the affected code path and first shipped in 5.80. The code content is identical to the consolidated version that passed the BlueZ CI on 2026-11-06 (CheckPatch, GitLint, builds, smatch, scan-build and functional tests, series 1203891), only split differently. Downstream bug report with reproducer and analysis: https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/2172906 Regarding regression tests: I agree they would be worthwhile. I could not find an existing harness that covers mpris-proxy, which is a standalone client tool rather than a daemon component, so neither unit/ nor test/functional/ has anything to build on. If there is a preferred place for such tests, I am happy to add one as a follow-up. Bastien Nocera (2): mpris-proxy: Fix possible crash mpris-proxy: Avoid session->obex dereference Kai-Chuan Hsieh (1): mpris-proxy: Check OBEX session proxy before use tools/mpris-proxy.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) -- 2.53.0 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH BlueZ v2 1/3] mpris-proxy: Fix possible crash 2026-11-25 9:20 ` [PATCH BlueZ 0/1] " Bastien Nocera 2026-11-26 6:47 ` [PATCH BlueZ v2 0/3] " Kai-Chuan Hsieh @ 2026-11-26 6:47 ` Kai-Chuan Hsieh 2026-11-26 14:54 ` [BlueZ,v2,1/3] " bluez.test.bot 2026-11-26 6:47 ` [PATCH BlueZ v2 2/3] mpris-proxy: Avoid session->obex dereference Kai-Chuan Hsieh 2026-11-26 6:47 ` [PATCH BlueZ v2 3/3] mpris-proxy: Check OBEX session proxy before use Kai-Chuan Hsieh 3 siblings, 1 reply; 10+ messages in thread From: Kai-Chuan Hsieh @ 2026-11-26 6:47 UTC (permalink / raw) To: linux-bluetooth; +Cc: hadess From: Bastien Nocera <hadess@hadess.net> find_player_by_obex() doesn't check whether session->obex is a valid pointer before dereferecing it, but all code paths that assign it use create_obex_session() to assign it, a function that can fail. Check whether session->obex is null before dereferencing it. #0 find_player_by_obex at tools/mpris-proxy.c:2819 #1 obex_property_changed at tools/mpris-proxy.c:2929 #2 add_property at gdbus/client.c:373 #3 update_properties at gdbus/client.c:399 #5 properties_changed at gdbus/client.c:537 #6 signal_filter at gdbus/watch.c:416 #7 message_filter at gdbus/watch.c:566 #10 message_dispatch at gdbus/mainloop.c:59 #13 g_main_context_dispatch_unlocked at ../glib/gmain.c:4451 #14 g_main_context_iterate_unlocked at ../glib/gmain.c:4516 Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2466640 Fixes: 01a5a26814 ("mpris-proxy: Add mpris:artUrl support") Signed-off-by: Kai-Chuan Hsieh <kaichuan.hsieh@canonical.com> --- tools/mpris-proxy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/mpris-proxy.c b/tools/mpris-proxy.c index e06b9ea3e..79cd52706 100644 --- a/tools/mpris-proxy.c +++ b/tools/mpris-proxy.c @@ -2816,8 +2816,12 @@ static struct player *find_player_by_obex(const char *path) for (l = players; l; l = l->next) { struct player *player = l->data; struct obex_session *session = player->obex; - const char *obex_path = g_dbus_proxy_get_path(session->obex); + const char *obex_path = NULL; + if (session == NULL) + continue; + + obex_path = g_dbus_proxy_get_path(session->obex); if (g_str_has_prefix(path, obex_path)) return player; } -- 2.53.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: [BlueZ,v2,1/3] mpris-proxy: Fix possible crash 2026-11-26 6:47 ` [PATCH BlueZ v2 1/3] mpris-proxy: Fix possible crash Kai-Chuan Hsieh @ 2026-11-26 14:54 ` bluez.test.bot 0 siblings, 0 replies; 10+ messages in thread From: bluez.test.bot @ 2026-11-26 14:54 UTC (permalink / raw) To: linux-bluetooth, kaichuan.hsieh [-- Attachment #1: Type: text/plain, Size: 3739 bytes --] This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/series/1222988/ ---Test result--- Test Summary: CheckPatch FAIL 1.02 seconds GitLint PASS 0.72 seconds BuildEll PASS 12.91 seconds BluezMake PASS 169.98 seconds CheckSmatch PASS 178.89 seconds bluezmakeextell PASS 59.82 seconds TestFunctional PASS 874.51 seconds IncrementalBuild PASS 172.03 seconds ScanBuild PASS 575.90 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: [BlueZ,v2,1/3] mpris-proxy: Fix possible crash WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12+ chars of sha1> ("<title line>")' - ie: 'Fixes: 01a5a268143e ("mpris-proxy: Add mpris:artUrl support")' #151: Fixes: 01a5a26814 ("mpris-proxy: Add mpris:artUrl support") /home/runner/work/bluez/bluez/src/patch/15024846.patch total: 0 errors, 1 warnings, 13 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /home/runner/work/bluez/bluez/src/patch/15024846.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [BlueZ,v2,2/3] mpris-proxy: Avoid session->obex dereference WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12+ chars of sha1> ("<title line>")' - ie: 'Fixes: 01a5a268143e ("mpris-proxy: Add mpris:artUrl support")' #136: Fixes: 01a5a26814 ("mpris-proxy: Add mpris:artUrl support") /home/runner/work/bluez/bluez/src/patch/15024845.patch total: 0 errors, 1 warnings, 30 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /home/runner/work/bluez/bluez/src/patch/15024845.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. [BlueZ,v2,3/3] mpris-proxy: Check OBEX session proxy before use WARNING:BAD_FIXES_TAG: Please use correct Fixes: style 'Fixes: <12+ chars of sha1> ("<title line>")' - ie: 'Fixes: 01a5a268143e ("mpris-proxy: Add mpris:artUrl support")' #141: Fixes: 01a5a26814 ("mpris-proxy: Add mpris:artUrl support") /home/runner/work/bluez/bluez/src/patch/15024847.patch total: 0 errors, 1 warnings, 29 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /home/runner/work/bluez/bluez/src/patch/15024847.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. https://github.com/bluez/bluez/pull/2932 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH BlueZ v2 2/3] mpris-proxy: Avoid session->obex dereference 2026-11-25 9:20 ` [PATCH BlueZ 0/1] " Bastien Nocera 2026-11-26 6:47 ` [PATCH BlueZ v2 0/3] " Kai-Chuan Hsieh 2026-11-26 6:47 ` [PATCH BlueZ v2 1/3] mpris-proxy: Fix possible crash Kai-Chuan Hsieh @ 2026-11-26 6:47 ` Kai-Chuan Hsieh 2026-11-26 6:47 ` [PATCH BlueZ v2 3/3] mpris-proxy: Check OBEX session proxy before use Kai-Chuan Hsieh 3 siblings, 0 replies; 10+ messages in thread From: Kai-Chuan Hsieh @ 2026-11-26 6:47 UTC (permalink / raw) To: linux-bluetooth; +Cc: hadess From: Bastien Nocera <hadess@hadess.net> Protect against trying to access session->obex variable that might be null after failure to create the session object. Fixes: 01a5a26814 ("mpris-proxy: Add mpris:artUrl support") Signed-off-by: Kai-Chuan Hsieh <kaichuan.hsieh@canonical.com> --- tools/mpris-proxy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/mpris-proxy.c b/tools/mpris-proxy.c index 79cd52706..125bc85d4 100644 --- a/tools/mpris-proxy.c +++ b/tools/mpris-proxy.c @@ -1306,7 +1306,7 @@ static int parse_track_entry(DBusMessageIter *entry, const char *key, const char *handle, *path; char *filename, *uri; - if (!player || !player->obex) + if (!player || !player->obex || !player->obex->obex) return -EINVAL; path = g_dbus_proxy_get_path(player->obex->obex); @@ -2614,9 +2614,13 @@ static void obex_get_image(struct player *player, const char *handle) DBusMessage *msg; DBusMessageIter iter, array; struct obex_session *obex_session = player->obex; - const char *path = g_dbus_proxy_get_path(obex_session->obex); + const char *path; char *filename; + if (!player->obex) + return; + + path = g_dbus_proxy_get_path(obex_session->obex); player->filename = g_strconcat(g_get_tmp_dir(), "/", path + strlen(BLUEZ_OBEX_CLIENT_PATH "/"), "-", handle, NULL); @@ -2674,7 +2678,7 @@ static void device_property_changed(GDBusProxy *proxy, const char *name, player->obex = NULL; } - g_dbus_proxy_unref(session->obex); + g_clear_pointer(&session->obex, g_dbus_proxy_unref); g_dbus_proxy_unref(session->device); obex_sessions = g_slist_remove(obex_sessions, session); g_free(session); -- 2.53.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH BlueZ v2 3/3] mpris-proxy: Check OBEX session proxy before use 2026-11-25 9:20 ` [PATCH BlueZ 0/1] " Bastien Nocera ` (2 preceding siblings ...) 2026-11-26 6:47 ` [PATCH BlueZ v2 2/3] mpris-proxy: Avoid session->obex dereference Kai-Chuan Hsieh @ 2026-11-26 6:47 ` Kai-Chuan Hsieh 3 siblings, 0 replies; 10+ messages in thread From: Kai-Chuan Hsieh @ 2026-11-26 6:47 UTC (permalink / raw) To: linux-bluetooth; +Cc: hadess connect_obex_session() can leave the inner OBEX proxy NULL, e.g. when CreateSession fails, while the player keeps the session. A Track change carrying an ImgHandle then passes a NULL proxy to g_dbus_proxy_get_path() and the resulting NULL path is used in pointer arithmetic, crashing the process. find_player_by_obex() likewise feeds a NULL path to g_str_has_prefix(). Skip players whose OBEX session has no proxy and check the path before use. Fixes: 01a5a26814 ("mpris-proxy: Add mpris:artUrl support") Closes: https://github.com/bluez/bluez/issues/2569 Link: https://github.com/bluez/bluez/pull/2631 Signed-off-by: Kai-Chuan Hsieh <kaichuan.hsieh@canonical.com> --- tools/mpris-proxy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/mpris-proxy.c b/tools/mpris-proxy.c index 125bc85d4..8547fa908 100644 --- a/tools/mpris-proxy.c +++ b/tools/mpris-proxy.c @@ -2617,10 +2617,11 @@ static void obex_get_image(struct player *player, const char *handle) const char *path; char *filename; - if (!player->obex) + if (!obex_session || !obex_session->obex) return; path = g_dbus_proxy_get_path(obex_session->obex); + player->filename = g_strconcat(g_get_tmp_dir(), "/", path + strlen(BLUEZ_OBEX_CLIENT_PATH "/"), "-", handle, NULL); @@ -2820,12 +2821,15 @@ static struct player *find_player_by_obex(const char *path) for (l = players; l; l = l->next) { struct player *player = l->data; struct obex_session *session = player->obex; - const char *obex_path = NULL; + const char *obex_path; - if (session == NULL) + if (session == NULL || session->obex == NULL) continue; obex_path = g_dbus_proxy_get_path(session->obex); + if (obex_path == NULL) + continue; + if (g_str_has_prefix(path, obex_path)) return player; } -- 2.53.0 ^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-26 14:54 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-06 8:05 [PATCH BlueZ 0/1] mpris-proxy: Fix possible crash on OBEX transfer Kai-Chuan Hsieh 2026-11-06 8:05 ` [PATCH BlueZ 1/1] " Kai-Chuan Hsieh 2026-11-06 10:47 ` bluez.test.bot 2026-11-21 10:19 ` bluez.test.bot 2026-11-25 9:20 ` [PATCH BlueZ 0/1] " Bastien Nocera 2026-11-26 6:47 ` [PATCH BlueZ v2 0/3] " Kai-Chuan Hsieh 2026-11-26 6:47 ` [PATCH BlueZ v2 1/3] mpris-proxy: Fix possible crash Kai-Chuan Hsieh 2026-11-26 14:54 ` [BlueZ,v2,1/3] " bluez.test.bot 2026-11-26 6:47 ` [PATCH BlueZ v2 2/3] mpris-proxy: Avoid session->obex dereference Kai-Chuan Hsieh 2026-11-26 6:47 ` [PATCH BlueZ v2 3/3] mpris-proxy: Check OBEX session proxy before use Kai-Chuan Hsieh
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox