public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Null pointer check on cb in finalize_resume()
@ 2009-03-26 23:50 Nick Pelly
  2009-03-27  9:49 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Pelly @ 2009-03-26 23:50 UTC (permalink / raw)
  To: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0002-Null-pointer-check-on-cb-in-finalize_resume.patch --]
[-- Type: text/x-patch, Size: 869 bytes --]

From 8f5f803f17bde189fc96a715498a98756ae9ff2b Mon Sep 17 00:00:00 2001
From: Nick Pelly <npelly@google.com>
Date: Thu, 26 Mar 2009 15:22:32 -0700
Subject: [PATCH] Null pointer check on cb in finalize_resume().

Fix a null pointer crash that occured when resuming A2DP streaming after making
an outgoing call.

This patch has not been verified in Bluez 4.x.
---
 audio/a2dp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/audio/a2dp.c b/audio/a2dp.c
index 7461f17..5fd6be4 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -183,7 +183,7 @@ static gboolean finalize_resume(struct a2dp_setup *s)
 	for (l = s->cb; l != NULL; l = l->next) {
 		struct a2dp_setup_cb *cb = l->data;
 
-		if (cb->resume_cb) {
+		if (cb && cb->resume_cb) {
 			cb->resume_cb(s->session, s->err, cb->user_data);
 			cb->resume_cb = NULL;
 			setup_unref(s);
-- 
1.5.5


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

* Re: [PATCH] Null pointer check on cb in finalize_resume()
  2009-03-26 23:50 [PATCH] Null pointer check on cb in finalize_resume() Nick Pelly
@ 2009-03-27  9:49 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2009-03-27  9:49 UTC (permalink / raw)
  To: Nick Pelly; +Cc: linux-bluetooth

Hi Nick,

Thanks for the patches. All of them, except for this one, seemed fine.

On Thu, Mar 26, 2009, Nick Pelly wrote:
> From: Nick Pelly <npelly@google.com>
> Date: Thu, 26 Mar 2009 15:22:32 -0700
> Subject: [PATCH] Null pointer check on cb in finalize_resume().
> 
> Fix a null pointer crash that occured when resuming A2DP streaming after
> making an outgoing call.

This looks like it's covering up for another bug where we've added a NULL
element into the list. I went through the current code and there are two places
where elements are added to the list. Both of these places use g_new0 which
will never return NULL (the default GLib behavior or to call abort() in the
case of an allocation failure) so most likely this added NULL check is
unnecessary with the current code base (but of course doesn't really hurt
either).

Johan

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

end of thread, other threads:[~2009-03-27  9:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26 23:50 [PATCH] Null pointer check on cb in finalize_resume() Nick Pelly
2009-03-27  9:49 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox