public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Matias Karhumaa <matias.karhumaa@gmail.com>
To: Johan Hedberg <johan.hedberg@gmail.com>, linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] obexd: Fix null pointer dereference.
Date: Thu, 22 Jun 2017 13:20:25 +0300	[thread overview]
Message-ID: <20170622102024.GA4634@makarhum-e6330> (raw)
In-Reply-To: <20170622061810.GA30856@x1c.home>

On Thu, Jun 22, 2017 at 09:18:10AM +0300, Johan Hedberg wrote:
> Hi Matias,
> 
> On Thu, Jun 22, 2017, Matias Karhumaa wrote:
> > > >> It seems to me that the bug is with opp.c passing the service_data to
> > > >> manager_request_authorization(), and service_data is expected to be the
> > > >> obex_transfer object. However, currently the code creates this object
> > > >> only upon CONNECT (in opp_connect).
> > > >>
> > > >> I think one possible way to solve this would be to trigger a call to
> > > >> os->service->connect if CONNECT hasn't been explicitly issued, however
> > > >> then the code needs to track this in some other way since service_data
> > > >> seems too unreliable.
> > > 
> > > How about the following:
> > > 
> > > https://gist.github.com/Vudentz/1736d6af9608b9332b93858d92a3feff
> > 
> > Your fix seems solid to me and fixes the crash with OPP. I checked ftp.c
> > also and saw potentially similar problem in ftp_chkput. Should we call
> > os->service->connect also in case of OBEX_FTP?
> 
> OPP is the only service where the specification allows skipping the
> connect step. This is why os->service gets pre-initialized to OPP (in
> the obex_session_start function). Also, if the OPP plugin isn't
> available os->service will be NULL before CONNECT, and that's something
> the code already seems to check for (e.g. in cmd_put). So unless I've
> misunderstood something, you shouldn't be able get to a situation where
> os->service points at FTP but CONNECT hasn't been issued.

Ok, understood. Actually I tried to do FTP PUT without CONNECT and I can
confirm that it works as you explained.

I will create a patch from the gist.

Best regards,
Matias Karhumaa

      reply	other threads:[~2017-06-22 10:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  6:14 [PATCH] obexd: Fix null pointer dereference Matias Karhumaa
2017-06-21  9:41 ` Johan Hedberg
2017-06-21 17:36   ` Luiz Augusto von Dentz
2017-06-21 19:31     ` Luiz Augusto von Dentz
2017-06-22  4:32       ` Matias Karhumaa
2017-06-22  6:18         ` Johan Hedberg
2017-06-22 10:20           ` Matias Karhumaa [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=20170622102024.GA4634@makarhum-e6330 \
    --to=matias.karhumaa@gmail.com \
    --cc=johan.hedberg@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