Commit Graph

317 Commits

Author SHA1 Message Date
huangcaihua 896e2d737c Gdbus:add debug for dump remove watch caller
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:51:00 +08:00
hujun5 8483eb6068 fix compile error
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-04-20 14:50:59 +08:00
huangcaihua 63aa5e82f6 gdbus:Add get_all_prop pending object to hold get proxy proper
Get proxy properties after interface added, before reply, if
recieved interface removed message, it's safer to cancel
pending_call object of get_all_prop at proxy free process.

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:57 +08:00
huangcaihua 4325564119 gdbus:Get proxy prop when interface adding
Even if a proxy has already been added, the properties
should still be retrieved when adding the interface.
because the proxy maybe not got prop before.

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:54 +08:00
huangcaihua 95f7ae14e4 gdbus:recover method call timer
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:50 +08:00
huangcaihua fa14d158fe gdbus:Fix method call noreply by keep one uv hanlder for read and write dbus_watch
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:45 +08:00
huangcaihua 63486b57f2 gdbus:Fix double free userdata when dbus send return false.
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:43 +08:00
huangcaihua 9164c02b25 gdbus:Add NULL check for destory point when send msg return false.
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:43 +08:00
huangcaihua 08da67f884 gdbus:Fix coverty for check return of asprintf
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 99e5730ccf Fix coverity for return value check
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 46a4c04b2a Fix coverity for mistake free dbus watcher
Only free just alloced data variable here. No need call filter_data_free which maybe free watcher.

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 3ccc8e7469 Fix coverity for FORWARD_NULL
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 733e4f985c Fix: Compile warning and memory leak
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua e09eba8530 refactor object file for open vela
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua df5657181d refactor watch file for open source
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 52af58e631 refactor polkit file for open source
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:42 +08:00
huangcaihua 1a3af6d20c GDBus:Set DBUS_TIMEOUT_INFINITE timer that is no dbus timeout
No need add reply timer for async method call.
if set -1, that is dbus default timer(25s).

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua b82a073fec revert debug assert for method call no reply.
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua bb17aa2c6c GDBus:No need add reply timer for async method call
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua 79fa23f209 Fix:Get New Added proxy proper need add getting_all_prop flag
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua 56c05a2344 Fix:gdbus notify proxy_added after proxy all properties got.
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:41 +08:00
huangcaihua c865342582 Fix:Coverity for spurious wakeup and null check_after_deref
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:40 +08:00
huangcaihua 0b5c32315a Fix:GDbus get prop sync from default loop
GDbus cache the proxy properties, for multi-thread, one thread gets
prop value which maybe freed by default loop thread.

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:40 +08:00
xujianhang 1237ebced0 gdbus: Resolve the Bluetooth module's failure to acquire the oFono NetworkOperator service
Signed-off-by: xujianhang <xujianhang@xiaomi.com>
2026-04-20 14:50:40 +08:00
huangcaihua 4a233cc203 Fix: remove signal filter when receive dbus disconnect msg
If the dbus disconnect message has been received,
it means that the current dbus connection is invalid.
The added disconnect message signal filter also needs to be free.

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:40 +08:00
huangcaihua 4e154ec370 Fix: Not get all proxy properties when any interface added
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:40 +08:00
huangcaihua e294794031 Fix:Add user_data for gdbus callback filter.
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:39 +08:00
huangcaihua 879f87f192 Fix: Must free client queue handle in async queue close callback func
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:39 +08:00
huangcaihua e1d5945591 Fix:Cancel pendingcall when received interface remove message
Gdbus will get properties when received interface add message,
If not cancel the getting properties pendingcall, it maybe use
freed proxy which will be freed after received interface remove message.

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:39 +08:00
huangcaihua fb9741cefe Fix:use async queue API to close async-queue handler
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:39 +08:00
huangcaihua 065ecd562a Fix:Add assert when recieve dbus NoReply Error
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:38 +08:00
huangcaihua f97e635d1e Fix: gdbus async send dbus message reply
dbus_connection_send_with_reply returned pendingcall object, then set pendingcall notify function.
When dbus reply, it will call dbus pendingcall handle process, and call notify fuction.
For both thread, ensure that the dbus pendingcall notify is set to execute first, and then execute the dbus reply call notify pendingcall process

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:38 +08:00
huangcaihua 2964ea5fec Fix: Add gdbus API comment
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:37 +08:00
xujianhang 865206ced0 frameworks/gdbus: fix the bug where method_call_reply is not executed probailistically
When the dbus message returns too quickly, the dbus message may return
before dbus_pending_call_set_notify is executed, resulting in the
callback function not being executed.

Signed-off-by: xujianhang <xujianhang@xiaomi.com>
2026-04-20 14:50:36 +08:00
huangcaihua e6590993e4 Fix: Add return false check for coverit
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:36 +08:00
huangcaihua 13e3d0e094 Fix: remove if null condition that won't be null
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:35 +08:00
huangcaihua 46636f9fc3 Fix: Change code to WebKit style
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:35 +08:00
huangcaihua d64f98f4fb Fix:gDBus support interface to filter proxy
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:35 +08:00
huangcaihua 6b4bc308f4 Fix: Filter can handle empty dbus signal message without crashing
Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2026-04-20 14:50:35 +08:00
dongjiuzhu1 048f80ea59 gdbs/pendingcall: Checks whether the pending call has received
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:34 +08:00
dongjiuzhu1 90998185f4 gdbus/mainloop: fix memory leak
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:34 +08:00
dongjiuzhu1 6ff9601505 gdbus/client: fix client->ready() multiple calling issue
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:33 +08:00
dongjiuzhu1 1a42b3605a gdbus/client: add dbus_proxy_remove_property_watch to free userdata
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:33 +08:00
dongjiuzhu1 7a3633f20c gdbus/client: support to control get properties for every proxy
neededby:964476

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:33 +08:00
dongjiuzhu1 b2b271e5cb gdbus/client: fix bug about using stack var save ptr of realloc issue
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:33 +08:00
dongjiuzhu1 0a33c0fff0 gdbus/client: call proxy_added() when proxy property parse done.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:32 +08:00
dongjiuzhu1 d3ccfd9120 framework/gdbus: using libuv replace glib loop
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2026-04-20 14:50:31 +08:00
dongjiuzhu1 e75b8325ad gdbus/client: hold pendingcall when get properites to avoid used after free.
when proxy is removed, proxy_free will cancel this pendcall of proxy to avoid
calling pending_reply_cb after proxy was removed, otherwise it will caused used
after free.

==174637==ERROR: AddressSanitizer: heap-use-after-free on address 0xf507c524 at pc 0x5ada152d bp 0xef013f98 sp 0xef013f88
READ of size 4 at 0xf507c524 thread T0
    #0 0x5ada152c in get_properties_reply_not_standard gdbus/client.c:1271
    #1 0x5ada00b3 in method_call_reply gdbus/client.c:1110
    #2 0x5a527468 in _dbus_pending_call_finish_completion dbus/dbus/dbus-pending-call.c:243
    #3 0x5a4e753d in complete_pending_call_and_unlock dbus/dbus/dbus-connection.c:2332
    #4 0x5a4f39d4 in dbus_connection_dispatch dbus/dbus/dbus-connection.c:4663
    #5 0x5a6d5451 in message_dispatch gdbus/mainloop.c:55
    #6 0x5a644109 in g_idle_dispatch glib/glib/gmain.c:6157
    #7 0x5a6364a3 in g_main_dispatch glib/glib/gmain.c:3477
    #8 0x5a63dbdd in g_main_context_dispatch glib/glib/gmain.c:4195
    #9 0x5a63e6db in g_main_context_iterate glib/glib/gmain.c:4271
    #10 0x5a63f998 in g_main_loop_run glib/glib/gmain.c:4471
    #11 0x5ad2ddda in telephonytool_main /home/mage1/data/n62_sim_new/frameworks/telephony/telephony_tool.c:4465
    #12 0x58f60272 in nxtask_startup sched/task_startup.c:70
    #13 0x58ef82b8 in nxtask_start task/task_start.c:134

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-20 14:50:31 +08:00
yintao bd30e99d5e utils/gdbus:Fix compile conflict
frameworks/utils/gdbus/polkit.c:139: multiple definition of polkit_check_authorization; /external/ofono/ofono/gdbus/polkit.c:157: first defined here

Signed-off-by: yintao <yintao@xiaomi.com>
2026-04-20 14:50:31 +08:00
yintao a9b05fc3d4 gdbus/watch.c: fix filter_data_call_and_free double free
ERROR: AddressSanitizer: attempting to call malloc_usable_size() for pointer which is not owned
#5 0x59c7dfb4 in filter_data_free gdbus/watch.c:221
    #6 0x59c7f10c in filter_data_call_and_free gdbus/watch.c:324
    #7 0x5aba939a in dbus_remove_all_watches gdbus/watch.c:824
    #8 0x5ab6b274 in tapi_close /home/yintao/ofo/220tele/frameworks/telephony/tapi_manager.c:369
    #9 0x5ab5238e in telephonytool_main /home/yintao/ofo/220tele/frameworks/telephony/telephony_tool.c:3422

Signed-off-by: yintao <yintao@xiaomi.com>
2026-04-20 14:50:31 +08:00