linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Jaganath Kanakkassery <jaganath.k@samsung.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Fix socket not getting freed if l2cap channel create fails
Date: Thu, 19 Jul 2012 10:52:46 +0300	[thread overview]
Message-ID: <20120719075239.GC26057@aemeltch-MOBL1> (raw)
In-Reply-To: <1342682644-24964-1-git-send-email-jaganath.k@samsung.com>

Hi Jaganath,

On Thu, Jul 19, 2012 at 12:54:04PM +0530, Jaganath Kanakkassery wrote:
> If l2cap_chan_create() fails then it will return from l2cap_sock_kill
> since zapped flag of sk is reset.
> 
> Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
> ---
>  net/bluetooth/l2cap_sock.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index 79350d1..419857d 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -1174,7 +1174,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int p
>  
>  	chan = l2cap_chan_create();
>  	if (!chan) {
> -		l2cap_sock_kill(sk);
> +		sk_free(sk);

Could you consider using sock_put which will call sk_free,
maybe we need to add also sock_orphan?

Best regards 
Andrei Emeltchenko 

>  		return NULL;
>  	}
>  
> -- 
> 1.7.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

  reply	other threads:[~2012-07-19  7:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19  7:24 [PATCH] Bluetooth: Fix socket not getting freed if l2cap channel create fails Jaganath Kanakkassery
2012-07-19  7:52 ` Andrei Emeltchenko [this message]
2012-07-19 11:20   ` Jaganath Kanakkassery
2012-07-19 11:40     ` Andrei Emeltchenko
2012-07-19 12:17       ` Jaganath Kanakkassery
2012-07-25  7:51 ` Gustavo Padovan

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=20120719075239.GC26057@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=jaganath.k@samsung.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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).