Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290895
b: refs/heads/master
c: d22015a
h: refs/heads/master
i:
  290893: ae4a2c1
  290891: 388e97f
  290887: abc8109
  290879: 7835871
v: v3
  • Loading branch information
Octavian Purdila authored and Johan Hedberg committed Feb 13, 2012
1 parent d9f717e commit 37c2fd3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 61e1b4b7de5c7e3b671e069f8bf7ee94dedbfde0
refs/heads/master: d22015aad40b4316f0f74c8e410debca44c3e6e2
2 changes: 2 additions & 0 deletions trunk/include/net/bluetooth/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,6 @@ void l2cap_exit(void);
int sco_init(void);
void sco_exit(void);

void bt_sock_reclassify_lock(struct sock *sk, int proto);

#endif /* __BLUETOOTH_H */
12 changes: 5 additions & 7 deletions trunk/net/bluetooth/af_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,16 @@ static const char *const bt_slock_key_strings[BT_MAX_PROTO] = {
"slock-AF_BLUETOOTH-BTPROTO_AVDTP",
};

static inline void bt_sock_reclassify_lock(struct socket *sock, int proto)
void bt_sock_reclassify_lock(struct sock *sk, int proto)
{
struct sock *sk = sock->sk;

if (!sk)
return;

BUG_ON(!sk);
BUG_ON(sock_owned_by_user(sk));

sock_lock_init_class_and_name(sk,
bt_slock_key_strings[proto], &bt_slock_key[proto],
bt_key_strings[proto], &bt_lock_key[proto]);
}
EXPORT_SYMBOL(bt_sock_reclassify_lock);

int bt_sock_register(int proto, const struct net_proto_family *ops)
{
Expand Down Expand Up @@ -145,7 +142,8 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto,

if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
err = bt_proto[proto]->create(net, sock, proto, kern);
bt_sock_reclassify_lock(sock, proto);
if (!err)
bt_sock_reclassify_lock(sock->sk, proto);
module_put(bt_proto[proto]->owner);
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/net/bluetooth/l2cap_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,8 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(void *data)
if (!sk)
return NULL;

bt_sock_reclassify_lock(sk, BTPROTO_L2CAP);

l2cap_sock_init(sk, parent);

return l2cap_pi(sk)->chan;
Expand Down
2 changes: 2 additions & 0 deletions trunk/net/bluetooth/rfcomm/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,8 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *
if (!sk)
goto done;

bt_sock_reclassify_lock(sk, BTPROTO_RFCOMM);

rfcomm_sock_init(sk, parent);
bacpy(&bt_sk(sk)->src, &src);
bacpy(&bt_sk(sk)->dst, &dst);
Expand Down

0 comments on commit 37c2fd3

Please sign in to comment.