All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Matias Karhumaa <matias.karhumaa@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] obexd: Fix null pointer dereference.
Date: Thu, 22 Jun 2017 09:18:10 +0300	[thread overview]
Message-ID: <20170622061810.GA30856@x1c.home> (raw)
In-Reply-To: <20170622043241.GA31744@makarhum-e6330>

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.

Johan

  reply	other threads:[~2017-06-22  6:18 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 [this message]
2017-06-22 10:20           ` Matias Karhumaa

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=20170622061810.GA30856@x1c.home \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=matias.karhumaa@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.