linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] bluetooth: fix not setting security level when creating a rfcomm session
Date: Tue, 03 Aug 2010 00:59:56 -0700	[thread overview]
Message-ID: <1280822396.12579.80.camel@localhost.localdomain> (raw)
In-Reply-To: <1280820383-10029-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

> This cause 'No Bonding' to be used if userspace has not yet been paired
> with remote device since the l2cap socket used to create the rfcomm
> session does not have any security level set.
> 
> Signed-off-by: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
> ---
>  net/bluetooth/rfcomm/core.c |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
> index 7dca91b..08f5757 100644
> --- a/net/bluetooth/rfcomm/core.c
> +++ b/net/bluetooth/rfcomm/core.c
> @@ -79,7 +79,10 @@ static void rfcomm_make_uih(struct sk_buff *skb, u8 addr);
>  
>  static void rfcomm_process_connect(struct rfcomm_session *s);
>  
> -static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *err);
> +static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src,
> +							bdaddr_t *dst,
> +							u8 sec_level,
> +							int *err);
>  static struct rfcomm_session *rfcomm_session_get(bdaddr_t *src, bdaddr_t *dst);
>  static void rfcomm_session_del(struct rfcomm_session *s);
>  
> @@ -402,7 +405,7 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
>  
>  	s = rfcomm_session_get(src, dst);
>  	if (!s) {
> -		s = rfcomm_session_create(src, dst, &err);
> +		s = rfcomm_session_create(src, dst, d->sec_level, &err);
>  		if (!s)
>  			return err;
>  	}
> @@ -680,7 +683,10 @@ static void rfcomm_session_close(struct rfcomm_session *s, int err)
>  	rfcomm_session_put(s);
>  }
>  
> -static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *err)
> +static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src,
> +							bdaddr_t *dst,
> +							u8 sec_level,
> +							int *err)
>  {
>  	struct rfcomm_session *s = NULL;
>  	struct sockaddr_l2 addr;
> @@ -705,6 +711,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
>  	sk = sock->sk;
>  	lock_sock(sk);
>  	l2cap_pi(sk)->imtu = l2cap_mtu;
> +	l2cap_pi(sk)->sec_level = sec_level;
>  	if (l2cap_ertm)
>  		l2cap_pi(sk)->mode = L2CAP_MODE_ERTM;
>  	release_sock(sk);

I see what you are trying to do here, but why is this needed? Shouldn't
it be already correctly set for PSM 3?

Regards

Marcel



  reply	other threads:[~2010-08-03  7:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03  7:26 [PATCH] bluetooth: fix not setting security level when creating a rfcomm session Luiz Augusto von Dentz
2010-08-03  7:59 ` Marcel Holtmann [this message]
2010-08-03  8:27   ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2010-08-19 11:06 Luiz Augusto von Dentz
2010-08-20 10:55 ` Ville Tervo
2010-10-28 13:07 ` Gustavo F. 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=1280822396.12579.80.camel@localhost.localdomain \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.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).