linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gustavo Padovan <gustavo@padovan.org>
To: ramm@ti.com
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Fix for double free of st buffer.
Date: Tue, 24 Jul 2012 20:01:24 -0300	[thread overview]
Message-ID: <20120724230124.GL20029@joana> (raw)
In-Reply-To: <1342511370-26470-1-git-send-email-ramm@ti.com>

Hi Ram,

* ramm@ti.com <ramm@ti.com> [2012-07-17 10:49:30 +0300]:

> From: Ram Malovany <ramm@ti.com>
> 
> When the Shared Transport line discipline driver (st_core) get data it
> pushes the skb received to the relevant protocol stacks , it then
> excepts that the relevant protocol stacks should handle the buffer ,
> and if it cannot then the stack should respond with an error.
> In our case the Bluetooth driver for shared transport (btwilink) should
> always be able to handle the buffer , in case of an error it will
> release it , thus we always should return 0.
> 
> Signed-off-by: Ram Malovany <ramm@ti.com>
> ---
>  drivers/bluetooth/btwilink.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
> index 8869469..1f60d84 100644
> --- a/drivers/bluetooth/btwilink.c
> +++ b/drivers/bluetooth/btwilink.c
> @@ -94,18 +94,22 @@ static void st_reg_completion_cb(void *priv_data, char data)
>  }
>  
>  /* Called by Shared Transport layer when receive data is
> - * available */
> + * available
> + * Return:
> + * 0 if buffer handled (affectivly allways even if error found)
> + * if return !=0 the buffer will be freed by the st
> + */
>  static long st_receive(void *priv_data, struct sk_buff *skb)
>  {
>  	struct ti_st *lhst = priv_data;
>  	int err;
>  
>  	if (!skb)
> -		return -EFAULT;
> +		return 0;
>  
>  	if (!lhst) {
>  		kfree_skb(skb);

If you remove this call to kfree_skb() from here doesn't it fixes your
problem?

	Gustavo

  reply	other threads:[~2012-07-24 23:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17  7:49 [PATCH] Bluetooth: Fix for double free of st buffer ramm
2012-07-24 23:01 ` Gustavo Padovan [this message]
2012-07-25  8:00   ` Malovany, Ram
2012-07-25  8:30   ` Malovany, Ram
2012-08-03 11:40   ` Malovany, Ram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120724230124.GL20029@joana \
    --to=gustavo@padovan.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ramm@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).