* [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply
@ 2013-09-26 8:02 Szymon Janc
2013-09-26 8:02 ` [PATCH 2/2] gdbus: Remove not needed check for NULL DBusPendingCall Szymon Janc
2013-10-14 8:12 ` [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply Szymon Janc
0 siblings, 2 replies; 4+ messages in thread
From: Szymon Janc @ 2013-09-26 8:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
>From D-Bus documentation for dbus_connection_send_with_reply():
"Warning: if the connection is disconnected or you try to send Unix file
descriptors on a connection that does not support them, the
DBusPendingCall will be set to NULL, so be careful with this."
Check this in g_dbus_send_message_with_reply so that callers don't need
to double check for NULL if g_dbus_send_message_with_reply returned
TRUE.
This also fix crash if passing FD over D-Bus is blocked e.g. by SELinux
policy.
bluetoothd[1894]: profiles/audio/avdtp.c:session_cb()
bluetoothd[1894]: profiles/audio/avdtp.c:avdtp_parse_cmd() Received
SET_CONFIGURATION_CMD
bluetoothd[1894]: profiles/audio/a2dp.c:endpoint_setconf_ind() Source
0x6c5000: Set_Configuration_Ind
bluetoothd[1894]: profiles/audio/avdtp.c:avdtp_ref() 0x6df360: ref=1
bluetoothd[1894]: profiles/audio/a2dp.c:setup_ref() 0x6d32b0: ref=1
process 1894: arguments to dbus_pending_call_set_notify() were incorrect,
assertion "pending != NULL" failed in file dbus-pending-call.c line
636.
This is normally a bug in some application using the D-Bus library.
---
gdbus/object.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/gdbus/object.c b/gdbus/object.c
index 0822fe8..268fed5 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -1510,11 +1510,20 @@ gboolean g_dbus_send_message_with_reply(DBusConnection *connection,
DBusMessage *message,
DBusPendingCall **call, int timeout)
{
+ dbus_bool_t ret;
+
/* Flush pending signal to guarantee message order */
g_dbus_flush(connection);
- return dbus_connection_send_with_reply(connection, message, call,
+ ret = dbus_connection_send_with_reply(connection, message, call,
timeout);
+
+ if (ret == TRUE && call != NULL && *call == NULL) {
+ error("Unable to send message (passing fd blocked?)");
+ return FALSE;
+ }
+
+ return ret;
}
gboolean g_dbus_send_error_valist(DBusConnection *connection,
--
1.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] gdbus: Remove not needed check for NULL DBusPendingCall
2013-09-26 8:02 [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply Szymon Janc
@ 2013-09-26 8:02 ` Szymon Janc
2013-10-14 8:12 ` [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply Szymon Janc
1 sibling, 0 replies; 4+ messages in thread
From: Szymon Janc @ 2013-09-26 8:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
It is now checked by g_dbus_send_message_with_reply() so there is no
need to double check that in caller.
---
gdbus/client.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/gdbus/client.c b/gdbus/client.c
index 7bffdad..be8cc29 100644
--- a/gdbus/client.c
+++ b/gdbus/client.c
@@ -112,11 +112,6 @@ static gboolean modify_match(DBusConnection *conn, const char *member,
return FALSE;
}
- if (call == NULL) {
- dbus_message_unref(msg);
- return FALSE;
- }
-
dbus_pending_call_set_notify(call, modify_match_reply, NULL, NULL);
dbus_pending_call_unref(call);
--
1.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply
2013-09-26 8:02 [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply Szymon Janc
2013-09-26 8:02 ` [PATCH 2/2] gdbus: Remove not needed check for NULL DBusPendingCall Szymon Janc
@ 2013-10-14 8:12 ` Szymon Janc
2013-10-14 11:38 ` Luiz Augusto von Dentz
1 sibling, 1 reply; 4+ messages in thread
From: Szymon Janc @ 2013-10-14 8:12 UTC (permalink / raw)
To: linux-bluetooth
> From D-Bus documentation for dbus_connection_send_with_reply():
> "Warning: if the connection is disconnected or you try to send Unix file
> descriptors on a connection that does not support them, the
> DBusPendingCall will be set to NULL, so be careful with this."
>
> Check this in g_dbus_send_message_with_reply so that callers don't need
> to double check for NULL if g_dbus_send_message_with_reply returned
> TRUE.
>
> This also fix crash if passing FD over D-Bus is blocked e.g. by SELinux
> policy.
>
> bluetoothd[1894]: profiles/audio/avdtp.c:session_cb()
> bluetoothd[1894]: profiles/audio/avdtp.c:avdtp_parse_cmd() Received
> SET_CONFIGURATION_CMD
> bluetoothd[1894]: profiles/audio/a2dp.c:endpoint_setconf_ind() Source
> 0x6c5000: Set_Configuration_Ind
> bluetoothd[1894]: profiles/audio/avdtp.c:avdtp_ref() 0x6df360: ref=1
> bluetoothd[1894]: profiles/audio/a2dp.c:setup_ref() 0x6d32b0: ref=1
> process 1894: arguments to dbus_pending_call_set_notify() were incorrect,
> assertion "pending != NULL" failed in file dbus-pending-call.c line
> 636.
> This is normally a bug in some application using the D-Bus library.
> ---
> gdbus/object.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/gdbus/object.c b/gdbus/object.c
> index 0822fe8..268fed5 100644
> --- a/gdbus/object.c
> +++ b/gdbus/object.c
> @@ -1510,11 +1510,20 @@ gboolean g_dbus_send_message_with_reply(DBusConnection *connection,
> DBusMessage *message,
> DBusPendingCall **call, int timeout)
> {
> + dbus_bool_t ret;
> +
> /* Flush pending signal to guarantee message order */
> g_dbus_flush(connection);
>
> - return dbus_connection_send_with_reply(connection, message, call,
> + ret = dbus_connection_send_with_reply(connection, message, call,
> timeout);
> +
> + if (ret == TRUE && call != NULL && *call == NULL) {
> + error("Unable to send message (passing fd blocked?)");
> + return FALSE;
> + }
> +
> + return ret;
> }
>
> gboolean g_dbus_send_error_valist(DBusConnection *connection,
>
ping
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply
2013-10-14 8:12 ` [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply Szymon Janc
@ 2013-10-14 11:38 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2013-10-14 11:38 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org
Hi Szymon,
On Mon, Oct 14, 2013 at 11:12 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
>
>> From D-Bus documentation for dbus_connection_send_with_reply():
>> "Warning: if the connection is disconnected or you try to send Unix file
>> descriptors on a connection that does not support them, the
>> DBusPendingCall will be set to NULL, so be careful with this."
>>
>> Check this in g_dbus_send_message_with_reply so that callers don't need
>> to double check for NULL if g_dbus_send_message_with_reply returned
>> TRUE.
>>
>> This also fix crash if passing FD over D-Bus is blocked e.g. by SELinux
>> policy.
>>
>> bluetoothd[1894]: profiles/audio/avdtp.c:session_cb()
>> bluetoothd[1894]: profiles/audio/avdtp.c:avdtp_parse_cmd() Received
>> SET_CONFIGURATION_CMD
>> bluetoothd[1894]: profiles/audio/a2dp.c:endpoint_setconf_ind() Source
>> 0x6c5000: Set_Configuration_Ind
>> bluetoothd[1894]: profiles/audio/avdtp.c:avdtp_ref() 0x6df360: ref=1
>> bluetoothd[1894]: profiles/audio/a2dp.c:setup_ref() 0x6d32b0: ref=1
>> process 1894: arguments to dbus_pending_call_set_notify() were incorrect,
>> assertion "pending != NULL" failed in file dbus-pending-call.c line
>> 636.
>> This is normally a bug in some application using the D-Bus library.
>> ---
>> gdbus/object.c | 11 ++++++++++-
>> 1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/gdbus/object.c b/gdbus/object.c
>> index 0822fe8..268fed5 100644
>> --- a/gdbus/object.c
>> +++ b/gdbus/object.c
>> @@ -1510,11 +1510,20 @@ gboolean g_dbus_send_message_with_reply(DBusConnection *connection,
>> DBusMessage *message,
>> DBusPendingCall **call, int timeout)
>> {
>> + dbus_bool_t ret;
>> +
>> /* Flush pending signal to guarantee message order */
>> g_dbus_flush(connection);
>>
>> - return dbus_connection_send_with_reply(connection, message, call,
>> + ret = dbus_connection_send_with_reply(connection, message, call,
>> timeout);
>> +
>> + if (ret == TRUE && call != NULL && *call == NULL) {
>> + error("Unable to send message (passing fd blocked?)");
>> + return FALSE;
>> + }
>> +
>> + return ret;
>> }
>>
>> gboolean g_dbus_send_error_valist(DBusConnection *connection,
>>
>
> ping
Applied, thanks.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-14 11:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-26 8:02 [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply Szymon Janc
2013-09-26 8:02 ` [PATCH 2/2] gdbus: Remove not needed check for NULL DBusPendingCall Szymon Janc
2013-10-14 8:12 ` [PATCH 1/2] gdbus: Check for NULL DBusPendingCall in g_dbus_send_message_with_reply Szymon Janc
2013-10-14 11:38 ` Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox