* [PATCH] Fix adapter reference count in input plugin
@ 2011-03-02 9:44 Szymon Janc
2011-03-04 18:38 ` Johan Hedberg
0 siblings, 1 reply; 3+ messages in thread
From: Szymon Janc @ 2011-03-02 9:44 UTC (permalink / raw)
To: linux-bluetooth; +Cc: par-gunnar.p.hjalmdahl, henrik.possung, Szymon Janc
Adapter unref was called on driver removal even if input server failed
to start on probe and reference was not incremented. This leads to
segmentation fault while removing adapter.
---
input/manager.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/input/manager.c b/input/manager.c
index a98a080..259aef7 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -143,6 +143,9 @@ static void hid_server_remove(struct btd_adapter *adapter)
{
bdaddr_t src;
+ if (!g_slist_find(adapters, adapter))
+ return;
+
adapter_get_address(adapter, &src);
server_stop(&src);
--
1.7.0.4
on behalf of ST-Ericsson
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Fix adapter reference count in input plugin
2011-03-02 9:44 [PATCH] Fix adapter reference count in input plugin Szymon Janc
@ 2011-03-04 18:38 ` Johan Hedberg
2011-03-04 19:02 ` Szymon Janc
0 siblings, 1 reply; 3+ messages in thread
From: Johan Hedberg @ 2011-03-04 18:38 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth, par-gunnar.p.hjalmdahl, henrik.possung
Hi Szymon,
On Wed, Mar 02, 2011, Szymon Janc wrote:
> Adapter unref was called on driver removal even if input server
> failed to start on probe and reference was not incremented. This leads
> to segmentation fault while removing adapter.
> ---
> input/manager.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/input/manager.c b/input/manager.c
> index a98a080..259aef7 100644
> --- a/input/manager.c
> +++ b/input/manager.c
> @@ -143,6 +143,9 @@ static void hid_server_remove(struct btd_adapter *adapter)
> {
> bdaddr_t src;
>
> + if (!g_slist_find(adapters, adapter))
> + return;
> +
> adapter_get_address(adapter, &src);
>
> server_stop(&src);
This one looks like it's working around the core issue instead of fixing
it. The _remove function shouldn't get called if _probe failed. I.e. the
issue seems to be somewhere in the core daemon.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Fix adapter reference count in input plugin
2011-03-04 18:38 ` Johan Hedberg
@ 2011-03-04 19:02 ` Szymon Janc
0 siblings, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2011-03-04 19:02 UTC (permalink / raw)
To: Johan Hedberg
Cc: linux-bluetooth@vger.kernel.org,
par-gunnar.p.hjalmdahl@stericsson.com,
henrik.possung@stericsson.com
> This one looks like it's working around the core issue instead of fixing
> it. The _remove function shouldn't get called if _probe failed. I.e. the
> issue seems to be somewhere in the core daemon.
Every btd_adapter_driver do that so I just followed.
But I agree that proper fix should be in core daemon i.e. flag in
btd_adapter_driver structure and set/test in load/unload_driver in adapter.c
or a separate list of activated drivers.
--
BR
Szymon Janc
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-03-04 19:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 9:44 [PATCH] Fix adapter reference count in input plugin Szymon Janc
2011-03-04 18:38 ` Johan Hedberg
2011-03-04 19:02 ` Szymon Janc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox