* [PATCH 0/1 v2] Fix no SEP if corresponding interface is disabled @ 2011-02-17 9:31 Dmitriy Paliy 2011-02-17 9:31 ` [PATCH " Dmitriy Paliy 0 siblings, 1 reply; 4+ messages in thread From: Dmitriy Paliy @ 2011-02-17 9:31 UTC (permalink / raw) To: linux-bluetooth, luiz.dentz Hi, Patch reworked wrt comments of Luiz provided in previous submission. Here check is done on enabled A2DP interfaces in audio.conf configuration file. If interface is not enabled then corresponding SEPs will not be created. BR, Dmitriy ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] Fix no SEP if corresponding interface is disabled 2011-02-17 9:31 [PATCH 0/1 v2] Fix no SEP if corresponding interface is disabled Dmitriy Paliy @ 2011-02-17 9:31 ` Dmitriy Paliy 2011-02-17 10:57 ` Luiz Augusto von Dentz 2011-02-17 18:35 ` Johan Hedberg 0 siblings, 2 replies; 4+ messages in thread From: Dmitriy Paliy @ 2011-02-17 9:31 UTC (permalink / raw) To: linux-bluetooth, luiz.dentz; +Cc: Dmitriy Paliy A2DP sink endpoint shall not be created if A2DP sink interface is disabled. Same holds for A2DP source endpoint and A2DP source interface. Such fixes bluetoothd crash when SDP record is registered and remote device tries to connect and stream to A2DP sink which is not initialized. Dereferencing of NULL happens in source_new_stream since device->source was not created. --- audio/a2dp.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/audio/a2dp.c b/audio/a2dp.c index 012fce8..3407d6f 100644 --- a/audio/a2dp.c +++ b/audio/a2dp.c @@ -110,6 +110,8 @@ struct a2dp_server { uint32_t source_record_id; uint32_t sink_record_id; uint16_t version; + gboolean sink_enabled; + gboolean source_enabled; }; static GSList *servers = NULL; @@ -1480,6 +1482,7 @@ proceed: else server->version = 0x0102; + server->source_enabled = source; if (source) { for (i = 0; i < sbc_srcs; i++) a2dp_add_sep(src, AVDTP_SEP_TYPE_SOURCE, @@ -1489,7 +1492,7 @@ proceed: a2dp_add_sep(src, AVDTP_SEP_TYPE_SOURCE, A2DP_CODEC_MPEG12, delay_reporting, NULL); } - + server->sink_enabled = sink; if (sink) { for (i = 0; i < sbc_sinks; i++) a2dp_add_sep(src, AVDTP_SEP_TYPE_SINK, @@ -1551,6 +1554,12 @@ struct a2dp_sep *a2dp_add_sep(const bdaddr_t *src, uint8_t type, if (server == NULL) return NULL; + if (type == AVDTP_SEP_TYPE_SINK && !server->sink_enabled) + return NULL; + + if (type == AVDTP_SEP_TYPE_SOURCE && !server->source_enabled) + return NULL; + sep = g_new0(struct a2dp_sep, 1); if (endpoint) { -- 1.7.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] Fix no SEP if corresponding interface is disabled 2011-02-17 9:31 ` [PATCH " Dmitriy Paliy @ 2011-02-17 10:57 ` Luiz Augusto von Dentz 2011-02-17 18:35 ` Johan Hedberg 1 sibling, 0 replies; 4+ messages in thread From: Luiz Augusto von Dentz @ 2011-02-17 10:57 UTC (permalink / raw) To: Dmitriy Paliy; +Cc: linux-bluetooth Hi, On Thu, Feb 17, 2011 at 11:31 AM, Dmitriy Paliy <dmitriy.paliy@nokia.com> wrote: > A2DP sink endpoint shall not be created if A2DP sink interface is disabled. > Same holds for A2DP source endpoint and A2DP source interface. > > Such fixes bluetoothd crash when SDP record is registered and remote > device tries to connect and stream to A2DP sink which is not initialized. > Dereferencing of NULL happens in source_new_stream since device->source > was not created. > --- > audio/a2dp.c | 11 ++++++++++- > 1 files changed, 10 insertions(+), 1 deletions(-) > > diff --git a/audio/a2dp.c b/audio/a2dp.c > index 012fce8..3407d6f 100644 > --- a/audio/a2dp.c > +++ b/audio/a2dp.c > @@ -110,6 +110,8 @@ struct a2dp_server { > uint32_t source_record_id; > uint32_t sink_record_id; > uint16_t version; > + gboolean sink_enabled; > + gboolean source_enabled; > }; > > static GSList *servers = NULL; > @@ -1480,6 +1482,7 @@ proceed: > else > server->version = 0x0102; > > + server->source_enabled = source; > if (source) { > for (i = 0; i < sbc_srcs; i++) > a2dp_add_sep(src, AVDTP_SEP_TYPE_SOURCE, > @@ -1489,7 +1492,7 @@ proceed: > a2dp_add_sep(src, AVDTP_SEP_TYPE_SOURCE, > A2DP_CODEC_MPEG12, delay_reporting, NULL); > } > - > + server->sink_enabled = sink; > if (sink) { > for (i = 0; i < sbc_sinks; i++) > a2dp_add_sep(src, AVDTP_SEP_TYPE_SINK, > @@ -1551,6 +1554,12 @@ struct a2dp_sep *a2dp_add_sep(const bdaddr_t *src, uint8_t type, > if (server == NULL) > return NULL; > > + if (type == AVDTP_SEP_TYPE_SINK && !server->sink_enabled) > + return NULL; > + > + if (type == AVDTP_SEP_TYPE_SOURCE && !server->source_enabled) > + return NULL; > + > sep = g_new0(struct a2dp_sep, 1); > > if (endpoint) { Looks much better. -- Luiz Augusto von Dentz Computer Engineer ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] Fix no SEP if corresponding interface is disabled 2011-02-17 9:31 ` [PATCH " Dmitriy Paliy 2011-02-17 10:57 ` Luiz Augusto von Dentz @ 2011-02-17 18:35 ` Johan Hedberg 1 sibling, 0 replies; 4+ messages in thread From: Johan Hedberg @ 2011-02-17 18:35 UTC (permalink / raw) To: Dmitriy Paliy; +Cc: linux-bluetooth, luiz.dentz Hi Dmitriy, On Thu, Feb 17, 2011, Dmitriy Paliy wrote: > A2DP sink endpoint shall not be created if A2DP sink interface is disabled. > Same holds for A2DP source endpoint and A2DP source interface. > > Such fixes bluetoothd crash when SDP record is registered and remote > device tries to connect and stream to A2DP sink which is not initialized. > Dereferencing of NULL happens in source_new_stream since device->source > was not created. > --- > audio/a2dp.c | 11 ++++++++++- > 1 files changed, 10 insertions(+), 1 deletions(-) Pushed upstream. Thanks. Johan ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-17 18:35 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-02-17 9:31 [PATCH 0/1 v2] Fix no SEP if corresponding interface is disabled Dmitriy Paliy 2011-02-17 9:31 ` [PATCH " Dmitriy Paliy 2011-02-17 10:57 ` Luiz Augusto von Dentz 2011-02-17 18:35 ` Johan Hedberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox