linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Jeremy Cline <jcline@redhat.com>
Cc: Johan Hedberg <johan.hedberg@gmail.com>,
	linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+257790c15bcdef6fe00c@syzkaller.appspotmail.com
Subject: Re: [PATCH] Bluetooth: hci_ldisc: Initialize hci_dev before open()
Date: Mon, 18 Feb 2019 13:55:30 +0100	[thread overview]
Message-ID: <37BAD6CD-1A0C-4DF2-95E0-2D75D7A75DB8@holtmann.org> (raw)
In-Reply-To: <20190206175416.4627-1-jcline@redhat.com>

Hi Jeremy,

> The hci_dev struct hdev is referenced in work queues and timers started
> by open() in some protocols. This creates a race between the
> initialization function and the work or timer which can result hdev
> being dereferenced while it is still null.
> 
> The syzbot report contains a reliable reproducer which causes a null
> pointer dereference of hdev in hci_uart_write_work() by making the
> memory allocation for hdev fail.
> 
> To fix this, ensure hdev is valid from before calling a protocol's
> open() until after calling a protocol's close().
> 
> Reported-by: syzbot+257790c15bcdef6fe00c@syzkaller.appspotmail.com
> Signed-off-by: Jeremy Cline <jcline@redhat.com>
> ---
> drivers/bluetooth/hci_ldisc.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


      reply	other threads:[~2019-02-18 12:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 17:54 [PATCH] Bluetooth: hci_ldisc: Initialize hci_dev before open() Jeremy Cline
2019-02-18 12:55 ` Marcel Holtmann [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=37BAD6CD-1A0C-4DF2-95E0-2D75D7A75DB8@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=jcline@redhat.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+257790c15bcdef6fe00c@syzkaller.appspotmail.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).