git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[Bluetooth] Add locking for bt_proto array manipulation
[pandora-kernel.git]
/
net
/
bluetooth
/
sco.c
diff --git
a/net/bluetooth/sco.c
b/net/bluetooth/sco.c
index
0c2d13a
..
5d13d4f
100644
(file)
--- a/
net/bluetooth/sco.c
+++ b/
net/bluetooth/sco.c
@@
-24,7
+24,6
@@
/* Bluetooth SCO sockets. */
/* Bluetooth SCO sockets. */
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/types.h>
@@
-109,17
+108,14
@@
static void sco_sock_init_timer(struct sock *sk)
static struct sco_conn *sco_conn_add(struct hci_conn *hcon, __u8 status)
{
struct hci_dev *hdev = hcon->hdev;
static struct sco_conn *sco_conn_add(struct hci_conn *hcon, __u8 status)
{
struct hci_dev *hdev = hcon->hdev;
- struct sco_conn *conn;
-
- if ((conn = hcon->sco_data))
- return conn;
+ struct sco_conn *conn = hcon->sco_data;
- if (status)
+ if (
conn ||
status)
return conn;
return conn;
- if (!(conn = kmalloc(sizeof(struct sco_conn), GFP_ATOMIC)))
+ conn = kzalloc(sizeof(struct sco_conn), GFP_ATOMIC);
+ if (!conn)
return NULL;
return NULL;
- memset(conn, 0, sizeof(struct sco_conn));
spin_lock_init(&conn->lock);
spin_lock_init(&conn->lock);
@@
-135,6
+131,7
@@
static struct sco_conn *sco_conn_add(struct hci_conn *hcon, __u8 status)
conn->mtu = 60;
BT_DBG("hcon %p conn %p", hcon, conn);
conn->mtu = 60;
BT_DBG("hcon %p conn %p", hcon, conn);
+
return conn;
}
return conn;
}
@@
-455,7
+452,8
@@
static int sco_sock_create(struct socket *sock, int protocol)
sock->ops = &sco_sock_ops;
sock->ops = &sco_sock_ops;
- if (!(sk = sco_sock_alloc(sock, protocol, GFP_KERNEL)))
+ sk = sco_sock_alloc(sock, protocol, GFP_ATOMIC);
+ if (!sk)
return -ENOMEM;
sco_sock_init(sk, NULL);
return -ENOMEM;
sco_sock_init(sk, NULL);
@@
-970,7
+968,8
@@
static int __init sco_init(void)
goto error;
}
goto error;
}
- class_create_file(&bt_class, &class_attr_sco);
+ if (class_create_file(bt_class, &class_attr_sco) < 0)
+ BT_ERR("Failed to create SCO info file");
BT_INFO("SCO (Voice Link) ver %s", VERSION);
BT_INFO("SCO socket layer initialized");
BT_INFO("SCO (Voice Link) ver %s", VERSION);
BT_INFO("SCO socket layer initialized");
@@
-984,7
+983,7
@@
error:
static void __exit sco_exit(void)
{
static void __exit sco_exit(void)
{
- class_remove_file(
&
bt_class, &class_attr_sco);
+ class_remove_file(bt_class, &class_attr_sco);
if (bt_sock_unregister(BTPROTO_SCO) < 0)
BT_ERR("SCO socket unregistration failed");
if (bt_sock_unregister(BTPROTO_SCO) < 0)
BT_ERR("SCO socket unregistration failed");