linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] gateway: Fix crash if SCO connection fails
@ 2012-02-21 16:46 Frédéric Dalleau
  2012-02-21 16:46 ` [PATCH v2 1/2] " Frédéric Dalleau
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Frédéric Dalleau @ 2012-02-21 16:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Frédéric Dalleau

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(-)

-- 
1.7.5.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] gateway: Fix crash if SCO connection fails
  2012-02-21 16:46 [PATCH v2 0/2] gateway: Fix crash if SCO connection fails Frédéric Dalleau
@ 2012-02-21 16:46 ` Frédéric Dalleau
  2012-02-22  8:43   ` Luiz Augusto von Dentz
  2012-02-21 16:46 ` [PATCH v2 2/2] media: register disconnect watch at transport add Frédéric Dalleau
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Frédéric Dalleau @ 2012-02-21 16:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Frédéric Dalleau

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(-)

diff --git a/audio/gateway.c b/audio/gateway.c
index 163f7b5..131f93f 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -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,
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] media: register disconnect watch at transport add
  2012-02-21 16:46 [PATCH v2 0/2] gateway: Fix crash if SCO connection fails Frédéric Dalleau
  2012-02-21 16:46 ` [PATCH v2 1/2] " Frédéric Dalleau
@ 2012-02-21 16:46 ` Frédéric Dalleau
  2012-02-22  8:42   ` Luiz Augusto von Dentz
  2012-03-08 10:14 ` [PATCH v2 0/2] gateway: Fix crash if SCO connection fails Dalleau, Frederic
  2012-03-08 23:58 ` Johan Hedberg
  3 siblings, 1 reply; 7+ messages in thread
From: Frédéric Dalleau @ 2012-02-21 16:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Frédéric Dalleau

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(-)

diff --git a/audio/transport.c b/audio/transport.c
index b319e0e..7bf7309 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -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);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] media: register disconnect watch at transport add
  2012-02-21 16:46 ` [PATCH v2 2/2] media: register disconnect watch at transport add Frédéric Dalleau
@ 2012-02-22  8:42   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-22  8:42 UTC (permalink / raw)
  To: Frédéric Dalleau; +Cc: linux-bluetooth

Hi Frederic,

2012/2/21 Frédéric Dalleau <frederic.dalleau@linux.intel.com>:
> 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(-)
>
> diff --git a/audio/transport.c b/audio/transport.c
> index b319e0e..7bf7309 100644
> --- a/audio/transport.c
> +++ b/audio/transport.c
> @@ -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);
> --
> 1.7.5.4

Ack

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] gateway: Fix crash if SCO connection fails
  2012-02-21 16:46 ` [PATCH v2 1/2] " Frédéric Dalleau
@ 2012-02-22  8:43   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2012-02-22  8:43 UTC (permalink / raw)
  To: Frédéric Dalleau; +Cc: linux-bluetooth

Hi Frederic,

2012/2/21 Frédéric Dalleau <frederic.dalleau@linux.intel.com>:
> 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(-)
>
> diff --git a/audio/gateway.c b/audio/gateway.c
> index 163f7b5..131f93f 100644
> --- a/audio/gateway.c
> +++ b/audio/gateway.c
> @@ -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,
> --
> 1.7.5.4

Ack

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] gateway: Fix crash if SCO connection fails
  2012-02-21 16:46 [PATCH v2 0/2] gateway: Fix crash if SCO connection fails Frédéric Dalleau
  2012-02-21 16:46 ` [PATCH v2 1/2] " Frédéric Dalleau
  2012-02-21 16:46 ` [PATCH v2 2/2] media: register disconnect watch at transport add Frédéric Dalleau
@ 2012-03-08 10:14 ` Dalleau, Frederic
  2012-03-08 23:58 ` Johan Hedberg
  3 siblings, 0 replies; 7+ messages in thread
From: Dalleau, Frederic @ 2012-03-08 10:14 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

2012/2/21 Frédéric Dalleau <frederic.dalleau@linux.intel.com>:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] gateway: Fix crash if SCO connection fails
  2012-02-21 16:46 [PATCH v2 0/2] gateway: Fix crash if SCO connection fails Frédéric Dalleau
                   ` (2 preceding siblings ...)
  2012-03-08 10:14 ` [PATCH v2 0/2] gateway: Fix crash if SCO connection fails Dalleau, Frederic
@ 2012-03-08 23:58 ` Johan Hedberg
  3 siblings, 0 replies; 7+ messages in thread
From: Johan Hedberg @ 2012-03-08 23:58 UTC (permalink / raw)
  To: Frédéric Dalleau; +Cc: linux-bluetooth

Hi Frédéric,

On Tue, Feb 21, 2012, Frédéric Dalleau wrote:
> 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(-)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-08 23:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-21 16:46 [PATCH v2 0/2] gateway: Fix crash if SCO connection fails Frédéric Dalleau
2012-02-21 16:46 ` [PATCH v2 1/2] " Frédéric Dalleau
2012-02-22  8:43   ` Luiz Augusto von Dentz
2012-02-21 16:46 ` [PATCH v2 2/2] media: register disconnect watch at transport add Frédéric Dalleau
2012-02-22  8:42   ` Luiz Augusto von Dentz
2012-03-08 10:14 ` [PATCH v2 0/2] gateway: Fix crash if SCO connection fails Dalleau, Frederic
2012-03-08 23:58 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).