linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] src/att: Fix usage of memory after it is freed.
@ 2014-12-19 14:01 Gowtham Anandha Babu
  2015-01-07  9:56 ` Gowtham Anandha Babu
  0 siblings, 1 reply; 3+ messages in thread
From: Gowtham Anandha Babu @ 2014-12-19 14:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs, Gowtham Anandha Babu

warning: Use of memory after it is freed
	respond_not_supported(att, opcode);
	^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 src/shared/att.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared/att.c b/src/shared/att.c
index 4be0652..a98909e 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -692,14 +692,14 @@ static void handle_notify(struct bt_att *att, uint8_t opcode, uint8_t *pdu,
 
 	queue_foreach(att->notify_list, notify_handler, &data);
 
-	bt_att_unref(att);
-
 	/*
 	 * If this was a request and no handler was registered for it, respond
 	 * with "Not Supported"
 	 */
 	if (!data.handler_found && get_op_type(opcode) == ATT_OP_TYPE_REQ)
 		respond_not_supported(att, opcode);
+
+	bt_att_unref(att);
 }
 
 static bool can_read_data(struct io *io, void *user_data)
-- 
1.9.1


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

* RE: [PATCH] src/att: Fix usage of memory after it is freed.
  2014-12-19 14:01 [PATCH] src/att: Fix usage of memory after it is freed Gowtham Anandha Babu
@ 2015-01-07  9:56 ` Gowtham Anandha Babu
  2015-01-07 13:34   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Gowtham Anandha Babu @ 2015-01-07  9:56 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: d.kasatkin, bharat.panda, cpgs

Ping.

> -----Original Message-----
> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-
> owner@vger.kernel.org] On Behalf Of Gowtham Anandha Babu
> Sent: Friday, December 19, 2014 7:31 PM
> To: linux-bluetooth@vger.kernel.org
> Cc: d.kasatkin@samsung.com; bharat.panda@samsung.com;
> cpgs@samsung.com; Gowtham Anandha Babu
> Subject: [PATCH] src/att: Fix usage of memory after it is freed.
> 
> warning: Use of memory after it is freed
> 	respond_not_supported(att, opcode);
> 	^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---
>  src/shared/att.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/shared/att.c b/src/shared/att.c index 4be0652..a98909e
> 100644
> --- a/src/shared/att.c
> +++ b/src/shared/att.c
> @@ -692,14 +692,14 @@ static void handle_notify(struct bt_att *att,
uint8_t
> opcode, uint8_t *pdu,
> 
>  	queue_foreach(att->notify_list, notify_handler, &data);
> 
> -	bt_att_unref(att);
> -
>  	/*
>  	 * If this was a request and no handler was registered for it,
respond
>  	 * with "Not Supported"
>  	 */
>  	if (!data.handler_found && get_op_type(opcode) ==
> ATT_OP_TYPE_REQ)
>  		respond_not_supported(att, opcode);
> +
> +	bt_att_unref(att);
>  }
> 
>  static bool can_read_data(struct io *io, void *user_data)
> --
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
> the body of a message to majordomo@vger.kernel.org More majordomo
> info at  http://vger.kernel.org/majordomo-info.html


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

* Re: [PATCH] src/att: Fix usage of memory after it is freed.
  2015-01-07  9:56 ` Gowtham Anandha Babu
@ 2015-01-07 13:34   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2015-01-07 13:34 UTC (permalink / raw)
  To: Gowtham Anandha Babu
  Cc: linux-bluetooth@vger.kernel.org, Dmitry Kasatkin, Bharat Panda,
	cpgs

Hi,

On Wed, Jan 7, 2015 at 7:56 AM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> Ping.
>
>> -----Original Message-----
>> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-
>> owner@vger.kernel.org] On Behalf Of Gowtham Anandha Babu
>> Sent: Friday, December 19, 2014 7:31 PM
>> To: linux-bluetooth@vger.kernel.org
>> Cc: d.kasatkin@samsung.com; bharat.panda@samsung.com;
>> cpgs@samsung.com; Gowtham Anandha Babu
>> Subject: [PATCH] src/att: Fix usage of memory after it is freed.
>>
>> warning: Use of memory after it is freed
>>       respond_not_supported(att, opcode);
>>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> ---
>>  src/shared/att.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/shared/att.c b/src/shared/att.c index 4be0652..a98909e
>> 100644
>> --- a/src/shared/att.c
>> +++ b/src/shared/att.c
>> @@ -692,14 +692,14 @@ static void handle_notify(struct bt_att *att,
> uint8_t
>> opcode, uint8_t *pdu,
>>
>>       queue_foreach(att->notify_list, notify_handler, &data);
>>
>> -     bt_att_unref(att);
>> -
>>       /*
>>        * If this was a request and no handler was registered for it,
> respond
>>        * with "Not Supported"
>>        */
>>       if (!data.handler_found && get_op_type(opcode) ==
>> ATT_OP_TYPE_REQ)
>>               respond_not_supported(att, opcode);
>> +
>> +     bt_att_unref(att);
>>  }
>>
>>  static bool can_read_data(struct io *io, void *user_data)
>> --
>> 1.9.1

Applied, thanks.


-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2015-01-07 13:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-19 14:01 [PATCH] src/att: Fix usage of memory after it is freed Gowtham Anandha Babu
2015-01-07  9:56 ` Gowtham Anandha Babu
2015-01-07 13:34   ` Luiz Augusto von Dentz

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