Linux bluetooth development
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: Johan Hedberg <johan.hedberg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 2/2] input: Fix crash when SDP record isn't available
Date: Sat, 07 Dec 2013 22:45:01 +0100	[thread overview]
Message-ID: <1386452701.32408.25.camel@nuvo> (raw)
In-Reply-To: <20131207175226.GB29280@x220.p-661hnu-f1>

On Sat, 2013-12-07 at 21:52 +0400, Johan Hedberg wrote:
> Hi Bastien,
> 
> On Sat, Dec 07, 2013, Bastien Nocera wrote:
> > On startup, if the SDP cache has been removed but the pairing
> > information is still present, we'd crash trying to access inside a
> > NULL record struct.
> > ---
> >  profiles/input/device.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/profiles/input/device.c b/profiles/input/device.c
> > index 521aca8..62f6dbb 100644
> > --- a/profiles/input/device.c
> > +++ b/profiles/input/device.c
> > @@ -811,6 +811,9 @@ static struct input_device *input_device_new(struct btd_service *service)
> >  	struct input_device *idev;
> >  	char name[HCI_MAX_NAME_LENGTH + 1];
> >  
> > +	if (!rec)
> > +		return NULL;
> > +
> >  	idev = g_new0(struct input_device, 1);
> >  	bacpy(&idev->src, btd_adapter_get_address(adapter));
> >  	bacpy(&idev->dst, device_get_address(device));
> 
> I've applied your first patch, but I'd like to understand a bit better
> how you'd end up in this situation. Is this accomplishable through BlueZ
> APIs or only if one goes and messes with the storage directly? Either
> way, is this the best approach or should we consider still creating the
> input device but just ignore the bits that depend on the SDP record?

I rm'ed the file in the cache/ directory. I'm not too fussed about what
the end result actually is, it just shouldn't crash. The same patch with
a warning that you shouldn't fiddle with the cache directory would be
fine as well ;)


  reply	other threads:[~2013-12-07 21:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-07 14:53 [PATCH 2/2] input: Fix crash when SDP record isn't available Bastien Nocera
2013-12-07 17:52 ` Johan Hedberg
2013-12-07 21:45   ` Bastien Nocera [this message]
2013-12-10  9:08     ` Johan Hedberg

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=1386452701.32408.25.camel@nuvo \
    --to=hadess@hadess.net \
    --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