2011-12-23 11:18:00

by Radoslaw Jablonski

[permalink] [raw]
Subject: [PATCH] audio: Use headset_shutdown in headset_setconf_cb

If pending connection will stay after state has been changed
to HEADSET_STATE_DISCONNECTED, then crash may happen (e.g. when
hs_connect will be called quickly again after that)
To avoid that kind of problems using headset_shutdown,
which does necessary cleanup first (finalizes pending connections)
and after that changes state to HEADSET_STATE_DISCONNECTED.
---
audio/media.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/audio/media.c b/audio/media.c
index a2ef437..a363b8e 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -197,7 +197,7 @@ static void headset_setconf_cb(struct media_endpoint *endpoint, void *ret,
if (ret != NULL)
return;

- headset_set_state(dev, HEADSET_STATE_DISCONNECTED);
+ headset_shutdown(dev);
}

static void clear_configuration(struct media_endpoint *endpoint)
--
1.7.0.4



2011-12-27 10:06:48

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] audio: Use headset_shutdown in headset_setconf_cb

Hi Radek,

On Fri, Dec 23, 2011, Radoslaw Jablonski wrote:
> If pending connection will stay after state has been changed
> to HEADSET_STATE_DISCONNECTED, then crash may happen (e.g. when
> hs_connect will be called quickly again after that)
> To avoid that kind of problems using headset_shutdown,
> which does necessary cleanup first (finalizes pending connections)
> and after that changes state to HEADSET_STATE_DISCONNECTED.
> ---
> audio/media.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)

Applied. Thanks.

Johan