Thanks for the review and sponsorship!

Addressed the non-blocker: test plan step 4 now spells out "how to send a file"
with three concrete OBEX Object Push methods (GNOME Settings -> Bluetooth
"Send Files...", Nautilus "Send to...", and the `bluetooth-sendto` CLI), notes
that the crash happens on the receiver, and mentions accepting the incoming
transfer and that the file lands in ~/Downloads.


** Description changed:

  [ Impact ]
  
  On Ubuntu 26.04 (bluez 5.85), the per-user `mpris-proxy` service crashes with
  SIGSEGV whenever an `org.bluez.obex.Transfer1` object emits a Status change --
  which happens on every OBEX transfer, including an incoming Bluetooth file 
push.
  The crash produces an apport crash-report dialog (update-notifier-crash ->
  whoopsie -> apport-gtk). The file transfer itself still completes, but the 
user
  is presented with a crash dialog every time, and the MPRIS/AVRCP media-control
  bridge dies and must be restarted.
  
  Root cause: in `tools/mpris-proxy.c`, `find_player_by_obex()` and related
  helpers dereference `player->obex` (and its inner `->obex` proxy) without a 
NULL
  check. A player legitimately has no OBEX session 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.
  
  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, so walking the list faults on the first player whose
  session is NULL. Any peer pushing a file over OBEX therefore crashes 
mpris-proxy
  as soon as one registered player lacks a cover-art session (the common 
config).
  
  This only affects 26.04: the BIP cover-art path (find_player_by_obex) was 
added
  between bluez 5.77 and 5.80; 24.04 ships bluez 5.72 without it.
  
  [ Test Plan ]
  
  Two Ubuntu 26.04 systems with working Bluetooth are required (or use the
  hardware-free D-Bus reproducer in bluez issue #2569).
  
  1. Install Ubuntu 26.04 on two systems (SUTs).
  2. Settings -> Bluetooth -> pair and connect the two systems.
  3. Confirm `mpris-proxy` is running: `systemctl --user status 
mpris-proxy.service`.
- 4. Send a file from one system to the other over Bluetooth (OBEX/OPP).
+ 4. Send a file from one system (the sender) to the other (the receiver) over
+    Bluetooth using OBEX Object Push (OPP). Any of these works; the crash 
happens
+    on the *receiver*:
+      a. GNOME Settings: on the sender open Settings -> Bluetooth, click the
+         paired receiver in the device list, and in the device dialog choose
+         "Send Files..." then pick any small file (e.g. an image or text file).
+      b. Files (Nautilus): right-click a file -> "Send to..." and select the
+         paired Bluetooth device, if the nautilus-sendto integration is 
present.
+      c. Command line (no GUI needed): on the sender run
+         `bluetooth-sendto --device=<RECEIVER_BT_MAC> /path/to/smallfile`
+         (the receiver's MAC is shown by `bluetoothctl devices` on the sender).
+    On the receiver, accept the incoming transfer if prompted
+    (Settings -> Bluetooth / the notification). The file lands in ~/Downloads.
  
  Without the fix: an apport crash dialog pops up; the journal shows
  `mpris-proxy[...]: segfault at 8 ...` and
  `mpris-proxy.service: ... code=dumped, status=11/SEGV`. The file still 
arrives.
  
  With the fix: the file transfers with no crash dialog, and
  `systemctl --user status mpris-proxy.service` shows no core dump.
  
  Quick confirmation of the root cause (without the fix):
  `systemctl --user mask mpris-proxy.service` on both units, then repeat the
  transfer -- the dialog no longer appears because the crashing service is 
absent.
  
  [ Where problems could occur ]
  
  The change is confined to `tools/mpris-proxy.c` (the mpris-proxy utility 
only);
  it does not touch the bluetoothd daemon, the OBEX daemon, or any library. It
  only adds defensive NULL/early-return guards before existing dereferences and
  replaces one `g_dbus_proxy_unref()` with `g_clear_pointer()` on the same 
pointer,
  so it cannot introduce new dereferences. The worst plausible regression is 
that
  a player whose OBEX session is transiently NULL is skipped in
  find_player_by_obex() for that one PropertiesChanged event -- i.e. a cover-art
  update could be missed in a race window -- which is strictly better than the
  current unconditional crash. If anything regressed, it would be visible as
  missing AVRCP cover-art images; core media playback/control is unaffected.
  
  [ Other Info ]
  
   * Upstream fix: PR https://github.com/bluez/bluez/pull/2098
     (Bastien Nocera, "mpris-proxy: Fix possible crash"; Closes Red Hat
     BZ 2466640). The PR passed CI but was auto-closed without landing; bluez
     5.86/5.87/master still carry the unguarded code, so this is carried as an
     Ubuntu delta.
   * Additional analysis and an extra guard for the inner `session->obex`
     (a failed CreateSession can leave it NULL) are described in bluez issue
     https://github.com/bluez/bluez/issues/2569. The Ubuntu patch includes that
     extra guard on top of PR #2098.
   * Internal tracking: WTN-503.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2172906

Title:
  mpris-proxy segfault (NULL deref in find_player_by_obex) triggers
  apport crash dialog during Bluetooth OBEX file transfer on 26.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/2172906/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to