linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Check for chan_type before locking sk
Date: Sat, 21 Jan 2012 17:40:01 +0100	[thread overview]
Message-ID: <1327164001.1955.49.camel@aeonflux> (raw)
In-Reply-To: <1327070100-4852-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

Hi Andrei,

> Removes un-needed locking/unlocking if chan_type is not
> L2CAP_CHAN_CONN_ORIENTED and also protects from locking
> zero sk.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/l2cap_core.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index b303eae..916ddb1 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -770,13 +770,12 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
>  	list_for_each_entry_rcu(chan, &conn->chan_l, list) {
>  		struct sock *sk = chan->sk;
>  
> -		bh_lock_sock(sk);
> -
>  		if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
> -			bh_unlock_sock(sk);
>  			continue;
>  		}

this actually raises the question how l2cap_chan is protected. Seems
like we are using the socket lock to protect it. Maybe that needs to be
untangled first.

Regards

Marcel



      reply	other threads:[~2012-01-21 16:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 14:35 [PATCH] Bluetooth: Check for chan_type before locking sk Emeltchenko Andrei
2012-01-21 16:40 ` Marcel Holtmann [this message]

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=1327164001.1955.49.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=Andrei.Emeltchenko.news@gmail.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).