From: Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
To: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [patches] a bunch of old bluetooth fixes
Date: Fri, 19 Dec 2014 06:18:01 +0000 [thread overview]
Message-ID: <20141219061801.GU22149@ZenIV.linux.org.uk> (raw)
This stuff has been sitting in my queue since March; basically,
several places in net/bluetooth assume that they are dealing with
l2cap sockets, while it is possible to get an arbitrary socket to those.
Results are not pretty.
* HIDPCONNADD gets an arbitrary user-supplied socket; the code
it calls (hidp_connection_add()) verifies that the socket is l2cap one,
but before doing so it finds l2cap_pi(ctrl_sock->sk)->chan. It's not
that big a deal (it's only 5 words past the end of struct sock), but
it's trivial to avoid and, in theory, we might end up oopsing here if
we are very unlucky and it happens to hit an unmapped page just past
the actual object ctrl_sock->sk sits in.
* CMTP counterpart of that doesn't validate the socket at all.
It proceeds to
s = __cmtp_get_session(&l2cap_pi(sock->sk)->chan->dst);
which can very easily oops - here ->chan is already garbage and we
proceed to dereference that. As with HIDP, one needs CAP_NET_ADMIN to
trigger that, but it's really a clear bug. The only sanity check we
do is verifying that nsock->sk->sk_state is equal to BT_CONNECTED,
which is not unique to bluetooth, to put it mildly. It's just 1,
so a TCP_ESTABLISHED tcp socket will pass that check just fune.
The fix is trivial...
* BNEP situation is identical to CMTP one.
I've sent these patches back then (March 10), but they seem to have fallen
through the cracks. The bugs are still there and the fixes still apply.
If you would prefer me to resend them after -rc1, just tell...
Anyway, patches follow
next reply other threads:[~2014-12-19 6:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-19 6:18 Al Viro [this message]
2014-12-19 6:20 ` [PATCH 1/3] bluetooth: hidp_connection_add() unsafe use of l2cap_pi() Al Viro
2014-12-19 12:49 ` Marcel Holtmann
2014-12-19 6:20 ` [PATCH 2/3] cmtp: cmtp_add_connection() should verify that it's dealing with l2cap socket Al Viro
2014-12-19 12:48 ` Marcel Holtmann
2014-12-19 6:20 ` [PATCH 3/3] bnep: bnep_add_connection() " Al Viro
2014-12-19 12:48 ` Marcel Holtmann
2014-12-19 10:28 ` [patches] a bunch of old bluetooth fixes Marcel Holtmann
2014-12-19 10:30 ` Marcel Holtmann
[not found] ` <07BDA2A2-1560-4F78-A0B2-FC25E312CACE-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2014-12-19 16:59 ` David Miller
2014-12-19 18:25 ` Marcel Holtmann
[not found] ` <B0609FEE-1CE5-4618-A0B6-B2B82B1EC74D-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2014-12-19 12:57 ` Marcel Holtmann
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=20141219061801.GU22149@ZenIV.linux.org.uk \
--to=viro-3bdd1+5odreifsdqtta3olvcufugdwfn@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).