diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/af_bluetooth.c | 12 | ||||
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 2 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/sock.c | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index ef92864ac625..72eb187a5f60 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -71,19 +71,16 @@ static const char *const bt_slock_key_strings[BT_MAX_PROTO] = { | |||
71 | "slock-AF_BLUETOOTH-BTPROTO_AVDTP", | 71 | "slock-AF_BLUETOOTH-BTPROTO_AVDTP", |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static inline void bt_sock_reclassify_lock(struct socket *sock, int proto) | 74 | void bt_sock_reclassify_lock(struct sock *sk, int proto) |
75 | { | 75 | { |
76 | struct sock *sk = sock->sk; | 76 | BUG_ON(!sk); |
77 | |||
78 | if (!sk) | ||
79 | return; | ||
80 | |||
81 | BUG_ON(sock_owned_by_user(sk)); | 77 | BUG_ON(sock_owned_by_user(sk)); |
82 | 78 | ||
83 | sock_lock_init_class_and_name(sk, | 79 | sock_lock_init_class_and_name(sk, |
84 | bt_slock_key_strings[proto], &bt_slock_key[proto], | 80 | bt_slock_key_strings[proto], &bt_slock_key[proto], |
85 | bt_key_strings[proto], &bt_lock_key[proto]); | 81 | bt_key_strings[proto], &bt_lock_key[proto]); |
86 | } | 82 | } |
83 | EXPORT_SYMBOL(bt_sock_reclassify_lock); | ||
87 | 84 | ||
88 | int bt_sock_register(int proto, const struct net_proto_family *ops) | 85 | int bt_sock_register(int proto, const struct net_proto_family *ops) |
89 | { | 86 | { |
@@ -145,7 +142,8 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto, | |||
145 | 142 | ||
146 | if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { | 143 | if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { |
147 | err = bt_proto[proto]->create(net, sock, proto, kern); | 144 | err = bt_proto[proto]->create(net, sock, proto, kern); |
148 | bt_sock_reclassify_lock(sock, proto); | 145 | if (!err) |
146 | bt_sock_reclassify_lock(sock->sk, proto); | ||
149 | module_put(bt_proto[proto]->owner); | 147 | module_put(bt_proto[proto]->owner); |
150 | } | 148 | } |
151 | 149 | ||
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index c57027f7606f..401d9428ae4c 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -849,6 +849,8 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(void *data) | |||
849 | if (!sk) | 849 | if (!sk) |
850 | return NULL; | 850 | return NULL; |
851 | 851 | ||
852 | bt_sock_reclassify_lock(sk, BTPROTO_L2CAP); | ||
853 | |||
852 | l2cap_sock_init(sk, parent); | 854 | l2cap_sock_init(sk, parent); |
853 | 855 | ||
854 | return l2cap_pi(sk)->chan; | 856 | return l2cap_pi(sk)->chan; |
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index f066678faeee..22169c3f1482 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -956,6 +956,8 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc * | |||
956 | if (!sk) | 956 | if (!sk) |
957 | goto done; | 957 | goto done; |
958 | 958 | ||
959 | bt_sock_reclassify_lock(sk, BTPROTO_RFCOMM); | ||
960 | |||
959 | rfcomm_sock_init(sk, parent); | 961 | rfcomm_sock_init(sk, parent); |
960 | bacpy(&bt_sk(sk)->src, &src); | 962 | bacpy(&bt_sk(sk)->src, &src); |
961 | bacpy(&bt_sk(sk)->dst, &dst); | 963 | bacpy(&bt_sk(sk)->dst, &dst); |