Linux bluetooth development
 help / color / mirror / Atom feed
From: chanyeol <chanyeol.park@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: jaganath.k@samsung.com,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH] Bluetooth: Fix potential NULL dereference
Date: Sun, 07 Jun 2015 00:35:13 +0900	[thread overview]
Message-ID: <1433604913.4256.4.camel@gmail.com> (raw)
In-Reply-To: <8D659FE1-24A7-43CF-9A85-F4C2C2A32DB9@holtmann.org>

Hi Marcel,

On Thu, 2015-05-14 at 08:34 +0200, Marcel Holtmann wrote:
> Hi Jaganath,
> 
> > > > addr can be NULL and it should not be dereferenced before NULL 
> > > > checking.
> > > > 
> > > > Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com>
> > > > ---
> > > 
> > > if we start changing things here, then we better change the code 
> > > into something that all the other socket handling code is doing 
> > > anyway>y. So do the min comparison and copy the data into a local 
> > > copy of the sockaddr_rc.
> > > 
> > > And on a side note, I wonder if addr can actually be NULL. It 
> > > might be interesting to check the generic socket code if this 
> > > really can happe>n if you provide no address structure to the 
> > > bind() system call or if this gets filtered out by the core 
> > > socket code.
> > 
> > I checked generic socket code and it looks like addr will never be 
> > NULL when user space calls bind.
> > But this can be called from kernel_bind() also which I think will 
> > never be called for RFCOMM.
> > So this patch is not required? 
> 
> that is what I thought. However converting it to the same handling 
> using min and copying into local storage might be a good idea.
Could you tell us why this is good idea? I failed to find it in git
history/mailing list.

In addition to RFCOMM connect that you mentioned, I found out SCO
connect/bind still use the old style in Bluetooth unlikely HCI,L2CAP.

Regards
Chanyeol

>  The more pieces in HCI, L2CAP, SCO and RFCOMM sockets that are 
> similar, the better.
> 
> Regards
> 
> Marcel
> 
> --
> 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:[~2015-06-06 15:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14  6:13 Re: [PATCH] Bluetooth: Fix potential NULL dereference JAGANATH KANAKKASSERY
2015-05-14  6:34 ` Marcel Holtmann
2015-06-06 15:35   ` chanyeol [this message]
2015-06-06 15:46     ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2015-05-15  5:37 JAGANATH KANAKKASSERY
2015-06-02  8:28 ` Jaganath K
2015-06-06  5:02   ` Marcel Holtmann
2015-05-13 12:14 Jaganath Kanakkassery
2015-05-13 20:34 ` Marcel Holtmann
2015-02-03  8:01 Johan Hedberg
2015-02-03  8:03 ` Marcel Holtmann

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=1433604913.4256.4.camel@gmail.com \
    --to=chanyeol.park@gmail.com \
    --cc=jaganath.k@samsung.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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