gateway: Fix crash if SCO connection fails
v2 cover gateway: Fix crash if SCO connection fails
Hi
The first patch is a resend of a previous patch with same name. The second one happens after the sco connection has failed : the disconnect watch is not removed when the media owner is freed upon error in acquire.
Let me know what you think.
Regards,
Frédéric
Frédéric Dalleau (2):
gateway: Fix crash if SCO connection fails
media: register disconnect watch at transport add
audio/gateway.c | 5 +---- audio/transport.c | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.5.4
PATCH v2 1/2 gateway: Fix crash if SCO connection fails
In some situations, a connect callback is created, but this callback is not added to media_owner. Thus when the owner is destroyed and at rfcomm disconnect, the callback is executed with an invalid pointer.
--- audio/gateway.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
audio/gateway.c +1 -4
@@ -836,12 +836,9 @@ unsigned int gateway_request_stream(struct audio_device *dev, gateway_stream_cb_t cb, void *user_data) { struct gateway *gw = dev->gateway; -unsigned int id;GError *err =NULL ;GIOChannel *io; - id =connect_cb_new (gw, cb, user_data); -if (!gw->rfcomm)get_records (dev);else if (!gw->sco) {
@@ -858,7 +855,7 @@ unsigned int gateway_request_stream(struct audio_device *dev, }else g_idle_add (request_stream_cb, dev); -return id; +return connect_cb_new (gw, cb, user_data); } int gateway_config_stream(struct audio_device *dev, gateway_stream_cb_t cb,
Signature · 1 line
1.7.5.4
Luiz Augusto von Dentz
maintainerHi Frederic,
2012/2/21 Frédéric Dalleau <[email protected]>:
Quoted 35 lines
In some situations, a connect callback is created, but this callback is not added to
media_owner. Thus when the owner is destroyed and at rfcomm disconnect, the callback is executed with an invalid pointer.
---
audio/gateway.c | 5 +----1 files changed, 1 insertions(+), 4 deletions(-)audio/gateway.c +1
-5@@ -836,12 +836,9 @@ unsigned int gateway_request_stream(struct audio_device *dev, gateway_stream_cb_t cb, void *user_data) { struct gateway *gw = dev->gateway; - unsigned int id; GError *err = NULL; GIOChannel *io; - id = connect_cb_new(gw, cb, user_data); - if (!gw->rfcomm) get_records(dev); else if (!gw->sco) {@@ -858,7 +855,7 @@ unsigned int gateway_request_stream(struct audio_device *dev, } else g_idle_add(request_stream_cb, dev); - return id; + return connect_cb_new(gw, cb, user_data); } int gateway_config_stream(struct audio_device *dev, gateway_stream_cb_t cb, --
Quoted 1 line
1.7.5.4
Ack
Signature · 1 line
Luiz Augusto von Dentz
PATCH v2 2/2 media: register disconnect watch at transport add
In reply to Frédéric Dalleaudisconnect watch is not removed when the media owner is freed if an error occurs while resuming in acquire (id == 0).
--- audio/transport.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
audio/transport.c +3 -3
@@ -599,6 +599,9 @@ static void media_transport_add(struct media_transport *transport,DBG ("Transport %s Owner %s" , transport->path, owner->name); transport->owners =g_slist_append (transport->owners, owner); owner->transport = transport; + owner->watch =g_dbus_add_disconnect_watch (transport->conn, owner->name, + media_owner_exit, + owner,NULL ); } static struct media_owner *media_owner_create(DBusConnection *conn,
@@ -610,9 +613,6 @@ static struct media_owner *media_owner_create(DBusConnection *conn, owner = g_new0(struct media_owner, 1); owner->name =g_strdup (dbus_message_get_sender (msg)); owner->accesstype =g_strdup (accesstype); - owner->watch =g_dbus_add_disconnect_watch (conn, owner->name, - media_owner_exit, - owner,NULL );DBG ("Owner created: sender=%s accesstype=%s" , owner->name, accesstype);
Signature · 1 line
1.7.5.4
Luiz Augusto von Dentz
maintainerRe: [PATCH v2 2/2] media: register disconnect watch at transport add
Hi Frederic,
2012/2/21 Frédéric Dalleau <[email protected]>:
Quoted 31 lines
disconnect watch is not removed when the media owner is freed if an error occurs while resuming in acquire (id == 0).
---
audio/transport.c | 6 +++---1 files changed, 3 insertions(+), 3 deletions(-)audio/transport.c +3
-4@@ -599,6 +599,9 @@ static void media_transport_add(struct media_transport *transport, DBG("Transport %s Owner %s", transport->path, owner->name); transport->owners = g_slist_append(transport->owners, owner); owner->transport = transport; + owner->watch = g_dbus_add_disconnect_watch(transport->conn, owner->name, + media_owner_exit, + owner, NULL); } static struct media_owner *media_owner_create(DBusConnection *conn,@@ -610,9 +613,6 @@ static struct media_owner *media_owner_create(DBusConnection *conn, owner = g_new0(struct media_owner, 1); owner->name = g_strdup(dbus_message_get_sender(msg)); owner->accesstype = g_strdup(accesstype); - owner->watch = g_dbus_add_disconnect_watch(conn, owner->name, - media_owner_exit, - owner, NULL); DBG("Owner created: sender=%s accesstype=%s", owner->name, accesstype); --
Quoted 1 line
1.7.5.4
Ack
Signature · 1 line
Luiz Augusto von Dentz
Hi,
2012/2/21 Frédéric Dalleau <[email protected]>:
Quoted 3 lines
The first patch is a resend of a previous patch with same name. The second one happens after the sco connection has failed : the disconnect watch is not removed when the media owner is freed upon error in acquire.
Luiz acked, any updates please?
Thanks,
Frédéric
Hi Frédéric,
Quoted 9 lines · Frédéric Dalleau
The first patch is a resend of a previous patch with same name. The second one happens after the sco connection has failed : the disconnect watch is not removed when the media owner is freed upon error in acquire.
Let me know what you think.
Regards,
Frédéric
Quoted 7 lines
Frédéric Dalleau (2):
gateway: Fix crash if SCO connection fails
media: register disconnect watch at transport addaudio/gateway.c | 5 +---- audio/transport.c | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-)
Both patches have been applied. Thanks.
Johan