From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: "Gustavo F. Padovan" <padovan@profusion.mobi>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Fix kernel crash on BT stress tests.
Date: Tue, 16 Feb 2010 14:16:17 +0200 [thread overview]
Message-ID: <508e92ca1002160416w5e116d2j678481e02e207c2f@mail.gmail.com> (raw)
In-Reply-To: <508e92ca1002160358g1c6b599bo329f4f51cae18041@mail.gmail.com>
Hi Gustavo,
>> Are you using ERTM or Streaming mode? If yes, I have a guess about the
>> source of the problem. On l2cap_parse_conf_rsp we check for:
>>
>> while (len >= L2CAP_CONF_OPT_SIZE) {
>> len -= l2cap_get_conf_opt(&rsp, &type, &olen, &val);
>>
>> But on case L2CAP_CONF_RFC olen is greater than L2CAP_CONF_OPT_SIZE we
>> can exceed the buffer size. So the right fix will be check if len >=
>> olen in that case.
>
> We use test tool which sends "Configure Response" packet with size 262
> bytes. So "req" buffer gets overwritten. But in the code nobody checks
> that "req" might be overwritten.
The packet we are sending is:
Bluetooth L2CAP Packet
Length: 266
CID: 0x0001
Command: Configure Response
Command Code: Configure Response (0x05)
Command Identifier: 0x02
Command Length: 262
Source CID: 0x0040
.... .... .... ...0 = Continuation Flag: False
Result: Failure - unacceptable parameters (0x0001)
Option: MTU
Option: MTU
Option: MTU
Option: MTU
Option: MTU
Option: MTU
Option: MTU
Option: MTU
Option: MTU
Option: MTU
.............
We can check of course that parameter MTU is already exist. Still
there is possibility to overwrite 64 bytes of req buffer so some check
is needed.
-- Andrei
next prev parent reply other threads:[~2010-02-16 12:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-16 10:36 [PATCH] Bluetooth: Fix kernel crash on BT stress tests Andrei Emeltchenko
2010-02-16 11:34 ` Gustavo F. Padovan
2010-02-16 11:58 ` Andrei Emeltchenko
2010-02-16 12:16 ` Andrei Emeltchenko [this message]
2010-02-17 23:57 ` Gustavo F. Padovan
2010-02-18 16:18 ` Andrei Emeltchenko
2010-03-11 14:54 ` Andrei Emeltchenko
2010-03-11 17:16 ` Marcel Holtmann
2010-03-11 22:41 ` Gustavo F. Padovan
2010-03-15 10:57 ` Andrei Emeltchenko
2010-03-15 15:05 ` Gustavo F. Padovan
2010-03-19 8:31 ` Andrei Emeltchenko
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=508e92ca1002160416w5e116d2j678481e02e207c2f@mail.gmail.com \
--to=andrei.emeltchenko.news@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=padovan@profusion.mobi \
/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).