From: David Woodhouse <dwmw2@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
Jiri Kosina <jkosina@suse.cz>,
Dmitry Torokhov <dtor@insightbb.com>,
Michal Piotrowski <michal.k.k.piotrowski@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Greg KH <greg@kroah.com>
Subject: [PATCH] Fix use-after-free oops in Bluetooth HID.
Date: Sat, 07 Jul 2007 14:58:39 -0400 [thread overview]
Message-ID: <1183834720.3066.83.camel@shinybook.infradead.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0707071135090.31544@woody.linux-foundation.org>
When cleaning up HIDP sessions, we currently close the ACL connection
before deregistering the input device. Closing the ACL connection
schedules a workqueue to remove the associated objects from sysfs, but
the input device still refers to them -- and if the workqueue happens to
run before the input device removal, the kernel will oops when trying to
look up PHYSDEVPATH for the removed input device.
Fix this by deregistering the input device before closing the
connections.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
--- net/bluetooth/hidp/core.c~ 2007-07-06 21:34:25.000000000 -0400
+++ net/bluetooth/hidp/core.c 2007-07-06 22:06:48.000000000 -0400
@@ -581,15 +581,6 @@ static int hidp_session(void *arg)
hidp_del_timer(session);
- fput(session->intr_sock->file);
-
- wait_event_timeout(*(ctrl_sk->sk_sleep),
- (ctrl_sk->sk_state == BT_CLOSED), msecs_to_jiffies(500));
-
- fput(session->ctrl_sock->file);
-
- __hidp_unlink_session(session);
-
if (session->input) {
input_unregister_device(session->input);
session->input = NULL;
@@ -601,6 +592,15 @@ static int hidp_session(void *arg)
hid_free_device(session->hid);
}
+ fput(session->intr_sock->file);
+
+ wait_event_timeout(*(ctrl_sk->sk_sleep),
+ (ctrl_sk->sk_state == BT_CLOSED), msecs_to_jiffies(500));
+
+ fput(session->ctrl_sock->file);
+
+ __hidp_unlink_session(session);
+
up_write(&hidp_session_sem);
kfree(session);
--
dwmw2
next prev parent reply other threads:[~2007-07-07 18:58 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-03 16:45 [1/2] 2.6.22-rc7: known regressions Michal Piotrowski
2007-07-03 17:29 ` Sparc32: random invalid instruction occourances on sparc32 (sun4c) Mark Fortescue
2007-07-03 18:57 ` [PATCH] " Mark Fortescue
2007-07-03 19:26 ` David Woodhouse
2007-07-03 21:25 ` Mark Fortescue
2007-07-03 21:56 ` David Woodhouse
2007-07-03 22:47 ` Mark Fortescue
2007-07-03 23:36 ` David Woodhouse
2007-07-04 3:27 ` Mark Fortescue
2007-07-04 3:33 ` David Woodhouse
2007-07-04 10:27 ` Mark Fortescue
2007-07-04 14:46 ` David Woodhouse
2007-07-04 18:38 ` Mark Fortescue
2007-07-03 21:41 ` David Miller
2007-07-03 22:01 ` David Woodhouse
2007-07-03 17:50 ` [1/2] 2.6.22-rc7: known regressions Bartlomiej Zolnierkiewicz
2007-07-03 23:09 ` David Chinner
2007-07-05 0:20 ` David Woodhouse
2007-07-05 1:26 ` [PATCH 2.6.22 REGRESSION] Fix slab redzone alignment David Woodhouse
2007-07-05 1:42 ` [1/2] 2.6.22-rc7: known regressions David Woodhouse
2007-07-05 16:28 ` Linus Torvalds
2007-07-05 16:43 ` David Woodhouse
2007-07-05 18:46 ` David Woodhouse
2007-07-05 19:31 ` David Woodhouse
2007-07-05 19:51 ` Linus Torvalds
2007-07-05 21:03 ` Dmitry Torokhov
2007-07-06 22:50 ` Jiri Kosina
2007-07-07 0:33 ` Dmitry Torokhov
2007-07-07 1:05 ` Jiri Kosina
2007-07-07 1:28 ` David Woodhouse
2007-07-07 2:25 ` David Woodhouse
2007-07-07 18:28 ` Marcel Holtmann
2007-07-07 18:36 ` Linus Torvalds
2007-07-07 18:58 ` David Woodhouse [this message]
2007-07-07 19:27 ` [PATCH] Fix use-after-free oops in Bluetooth HID Linus Torvalds
2007-07-09 2:32 ` Dmitry Torokhov
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=1183834720.3066.83.camel@shinybook.infradead.org \
--to=dwmw2@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=dtor@insightbb.com \
--cc=greg@kroah.com \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=michal.k.k.piotrowski@gmail.com \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®