diff options
author | Uwe Stuehler <uwe@cvs.openbsd.org> | 2008-11-22 16:56:40 +0000 |
---|---|---|
committer | Uwe Stuehler <uwe@cvs.openbsd.org> | 2008-11-22 16:56:40 +0000 |
commit | 7c8bd6b07b520b6cab268b9737cb3c788271536c (patch) | |
tree | 0ec2f35b85609c76a701bdde6890534814d7ca87 /sys/netbt/hci_unit.c | |
parent | ad3f16accaeb6e4bdc9d163769405937f977144c (diff) |
Stop a possible race in hci_enable()
Diffstat (limited to 'sys/netbt/hci_unit.c')
-rw-r--r-- | sys/netbt/hci_unit.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/netbt/hci_unit.c b/sys/netbt/hci_unit.c index 5fb9cc3717b..10700775447 100644 --- a/sys/netbt/hci_unit.c +++ b/sys/netbt/hci_unit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hci_unit.c,v 1.9 2008/11/22 04:42:58 uwe Exp $ */ +/* $OpenBSD: hci_unit.c,v 1.10 2008/11/22 16:56:39 uwe Exp $ */ /* $NetBSD: hci_unit.c,v 1.12 2008/06/26 14:17:27 plunky Exp $ */ /*- @@ -136,6 +136,13 @@ hci_enable(struct hci_unit *unit) int err; /* + * Block further attempts to enable the interface until the + * previous attempt has completed. + */ + if (unit->hci_flags & BTF_INIT) + return EBUSY; + + /* * Bluetooth spec says that a device can accept one * command on power up until they send a Command Status * or Command Complete event with more information, but |