From: Marcel Holtmann <marcel@holtmann.org>
To: Nathan Holstein <nathan.holstein@gmail.com>
Cc: "Gustavo F. Padovan" <padovan@profusion.mobi>,
linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] fix oops in l2cap_connect_req
Date: Fri, 15 Oct 2010 22:35:20 +0300 [thread overview]
Message-ID: <1287171320.3316.62.camel@aeonflux> (raw)
In-Reply-To: <AANLkTi=xxj81e__fH1Bh8KuL_rmHVi0=ia9ELPUMThr-@mail.gmail.com>
Hi Nathan,
> > * Nathan Holstein <nathan.holstein@gmail.com> [2010-10-14 18:37:53 -0400]:
> >
> >> (Please keep me in the CC list, I'm not subscribed to lkml)
> >>
> >> [1] L2CAP module dereferences an uninitialized pointer within l2cap_connect_req.
> >>
> >> [2] I'm currently testing a 2.6.35 kernel on a Nexus One with backported
> >> patches from bluetooth-2.6. When testing against certain BT devices, I'm seeing
> >> a null-pointer deref. The crash is caused by this portion of commit e9aeb2dd:
> >>
> >> @@ -2966,6 +2991,15 @@ sendresp:
> >> L2CAP_INFO_REQ, sizeof(info), &info);
> >> }
> >>
> >> + if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) &&
> >> + result == L2CAP_CR_SUCCESS) {
> >> + u8 buf[128];
> >> + l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
> >> + l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ,
> >> + l2cap_build_conf_req(sk, buf), buf);
> >> + l2cap_pi(sk)->num_conf_req++;
> >> + }
> >> +
> >> return 0;
> >> }
> >>
> >> Multiple error cases jump to the response & sendresp labels prior to
> >> initializing
> >> the "sk" variable. In the case I'm currently seeing, the remote BT
> >> device fails to
> >> properly secure the ACL, making this crash 100% reproducible.
> >>
> >> [3] Bluetooth, L2CAP
> >>
> >> [4] This bug appears to be in the mainline 2.6.36-rc? kernel, in addition to
> >> multiple Bluetooth development trees
> >>
> >> The following patch fixes the crash.
> >>
> >>
> >> --nathan
please send new patches with [PATCH v2] prefix to make it easier for
Gustavo to keep track.
> >> In error cases when the ACL is insecure or we fail to allocate a new
> >> struct sock, we jump to the "response" label. If so, "sk" will be
> >> uninitialized and the kernel crashes.
> >>
> >> Signed-off-by: Nathan Holstein <nathan.holstein@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
next prev parent reply other threads:[~2010-10-15 19:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 22:37 [PATCH] fix oops in l2cap_connect_req Nathan Holstein
2010-10-14 21:37 ` Gustavo F. Padovan
2010-10-15 15:54 ` Nathan Holstein
2010-10-15 19:35 ` Marcel Holtmann [this message]
2010-10-16 23:25 ` Gustavo F. Padovan
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=1287171320.3316.62.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan.holstein@gmail.com \
--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