diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/af_bluetooth.c | 7 | ||||
-rw-r--r-- | net/bluetooth/bnep/sock.c | 4 | ||||
-rw-r--r-- | net/bluetooth/cmtp/sock.c | 4 | ||||
-rw-r--r-- | net/bluetooth/hci_sock.c | 4 | ||||
-rw-r--r-- | net/bluetooth/hidp/sock.c | 4 | ||||
-rw-r--r-- | net/bluetooth/l2cap.c | 10 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/sock.c | 10 | ||||
-rw-r--r-- | net/bluetooth/sco.c | 10 |
8 files changed, 28 insertions, 25 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index d942b946ba07..1220d8a41eb5 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -95,10 +95,13 @@ int bt_sock_unregister(int proto) | |||
95 | } | 95 | } |
96 | EXPORT_SYMBOL(bt_sock_unregister); | 96 | EXPORT_SYMBOL(bt_sock_unregister); |
97 | 97 | ||
98 | static int bt_sock_create(struct socket *sock, int proto) | 98 | static int bt_sock_create(struct net *net, struct socket *sock, int proto) |
99 | { | 99 | { |
100 | int err; | 100 | int err; |
101 | 101 | ||
102 | if (net != &init_net) | ||
103 | return -EAFNOSUPPORT; | ||
104 | |||
102 | if (proto < 0 || proto >= BT_MAX_PROTO) | 105 | if (proto < 0 || proto >= BT_MAX_PROTO) |
103 | return -EINVAL; | 106 | return -EINVAL; |
104 | 107 | ||
@@ -113,7 +116,7 @@ static int bt_sock_create(struct socket *sock, int proto) | |||
113 | read_lock(&bt_proto_lock); | 116 | read_lock(&bt_proto_lock); |
114 | 117 | ||
115 | if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { | 118 | if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { |
116 | err = bt_proto[proto]->create(sock, proto); | 119 | err = bt_proto[proto]->create(net, sock, proto); |
117 | module_put(bt_proto[proto]->owner); | 120 | module_put(bt_proto[proto]->owner); |
118 | } | 121 | } |
119 | 122 | ||
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c index 10292e776046..f718965f296c 100644 --- a/net/bluetooth/bnep/sock.c +++ b/net/bluetooth/bnep/sock.c | |||
@@ -204,7 +204,7 @@ static struct proto bnep_proto = { | |||
204 | .obj_size = sizeof(struct bt_sock) | 204 | .obj_size = sizeof(struct bt_sock) |
205 | }; | 205 | }; |
206 | 206 | ||
207 | static int bnep_sock_create(struct socket *sock, int protocol) | 207 | static int bnep_sock_create(struct net *net, struct socket *sock, int protocol) |
208 | { | 208 | { |
209 | struct sock *sk; | 209 | struct sock *sk; |
210 | 210 | ||
@@ -213,7 +213,7 @@ static int bnep_sock_create(struct socket *sock, int protocol) | |||
213 | if (sock->type != SOCK_RAW) | 213 | if (sock->type != SOCK_RAW) |
214 | return -ESOCKTNOSUPPORT; | 214 | return -ESOCKTNOSUPPORT; |
215 | 215 | ||
216 | sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto, 1); | 216 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto, 1); |
217 | if (!sk) | 217 | if (!sk) |
218 | return -ENOMEM; | 218 | return -ENOMEM; |
219 | 219 | ||
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c index 19be7861e51e..cf700c20d11e 100644 --- a/net/bluetooth/cmtp/sock.c +++ b/net/bluetooth/cmtp/sock.c | |||
@@ -195,7 +195,7 @@ static struct proto cmtp_proto = { | |||
195 | .obj_size = sizeof(struct bt_sock) | 195 | .obj_size = sizeof(struct bt_sock) |
196 | }; | 196 | }; |
197 | 197 | ||
198 | static int cmtp_sock_create(struct socket *sock, int protocol) | 198 | static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol) |
199 | { | 199 | { |
200 | struct sock *sk; | 200 | struct sock *sk; |
201 | 201 | ||
@@ -204,7 +204,7 @@ static int cmtp_sock_create(struct socket *sock, int protocol) | |||
204 | if (sock->type != SOCK_RAW) | 204 | if (sock->type != SOCK_RAW) |
205 | return -ESOCKTNOSUPPORT; | 205 | return -ESOCKTNOSUPPORT; |
206 | 206 | ||
207 | sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto, 1); | 207 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto, 1); |
208 | if (!sk) | 208 | if (!sk) |
209 | return -ENOMEM; | 209 | return -ENOMEM; |
210 | 210 | ||
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 5ccea5fbd236..43dd6373bff9 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -634,7 +634,7 @@ static struct proto hci_sk_proto = { | |||
634 | .obj_size = sizeof(struct hci_pinfo) | 634 | .obj_size = sizeof(struct hci_pinfo) |
635 | }; | 635 | }; |
636 | 636 | ||
637 | static int hci_sock_create(struct socket *sock, int protocol) | 637 | static int hci_sock_create(struct net *net, struct socket *sock, int protocol) |
638 | { | 638 | { |
639 | struct sock *sk; | 639 | struct sock *sk; |
640 | 640 | ||
@@ -645,7 +645,7 @@ static int hci_sock_create(struct socket *sock, int protocol) | |||
645 | 645 | ||
646 | sock->ops = &hci_sock_ops; | 646 | sock->ops = &hci_sock_ops; |
647 | 647 | ||
648 | sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto, 1); | 648 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto, 1); |
649 | if (!sk) | 649 | if (!sk) |
650 | return -ENOMEM; | 650 | return -ENOMEM; |
651 | 651 | ||
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c index 0c185257e55b..1de2b6fbcac0 100644 --- a/net/bluetooth/hidp/sock.c +++ b/net/bluetooth/hidp/sock.c | |||
@@ -246,7 +246,7 @@ static struct proto hidp_proto = { | |||
246 | .obj_size = sizeof(struct bt_sock) | 246 | .obj_size = sizeof(struct bt_sock) |
247 | }; | 247 | }; |
248 | 248 | ||
249 | static int hidp_sock_create(struct socket *sock, int protocol) | 249 | static int hidp_sock_create(struct net *net, struct socket *sock, int protocol) |
250 | { | 250 | { |
251 | struct sock *sk; | 251 | struct sock *sk; |
252 | 252 | ||
@@ -255,7 +255,7 @@ static int hidp_sock_create(struct socket *sock, int protocol) | |||
255 | if (sock->type != SOCK_RAW) | 255 | if (sock->type != SOCK_RAW) |
256 | return -ESOCKTNOSUPPORT; | 256 | return -ESOCKTNOSUPPORT; |
257 | 257 | ||
258 | sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, 1); | 258 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, 1); |
259 | if (!sk) | 259 | if (!sk) |
260 | return -ENOMEM; | 260 | return -ENOMEM; |
261 | 261 | ||
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index c4e4ce4ebb2b..36ef27b625db 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -518,11 +518,11 @@ static struct proto l2cap_proto = { | |||
518 | .obj_size = sizeof(struct l2cap_pinfo) | 518 | .obj_size = sizeof(struct l2cap_pinfo) |
519 | }; | 519 | }; |
520 | 520 | ||
521 | static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, gfp_t prio) | 521 | static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio) |
522 | { | 522 | { |
523 | struct sock *sk; | 523 | struct sock *sk; |
524 | 524 | ||
525 | sk = sk_alloc(PF_BLUETOOTH, prio, &l2cap_proto, 1); | 525 | sk = sk_alloc(net, PF_BLUETOOTH, prio, &l2cap_proto, 1); |
526 | if (!sk) | 526 | if (!sk) |
527 | return NULL; | 527 | return NULL; |
528 | 528 | ||
@@ -543,7 +543,7 @@ static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, gfp_t prio) | |||
543 | return sk; | 543 | return sk; |
544 | } | 544 | } |
545 | 545 | ||
546 | static int l2cap_sock_create(struct socket *sock, int protocol) | 546 | static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol) |
547 | { | 547 | { |
548 | struct sock *sk; | 548 | struct sock *sk; |
549 | 549 | ||
@@ -560,7 +560,7 @@ static int l2cap_sock_create(struct socket *sock, int protocol) | |||
560 | 560 | ||
561 | sock->ops = &l2cap_sock_ops; | 561 | sock->ops = &l2cap_sock_ops; |
562 | 562 | ||
563 | sk = l2cap_sock_alloc(sock, protocol, GFP_ATOMIC); | 563 | sk = l2cap_sock_alloc(net, sock, protocol, GFP_ATOMIC); |
564 | if (!sk) | 564 | if (!sk) |
565 | return -ENOMEM; | 565 | return -ENOMEM; |
566 | 566 | ||
@@ -1425,7 +1425,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
1425 | goto response; | 1425 | goto response; |
1426 | } | 1426 | } |
1427 | 1427 | ||
1428 | sk = l2cap_sock_alloc(NULL, BTPROTO_L2CAP, GFP_ATOMIC); | 1428 | sk = l2cap_sock_alloc(parent->sk_net, NULL, BTPROTO_L2CAP, GFP_ATOMIC); |
1429 | if (!sk) | 1429 | if (!sk) |
1430 | goto response; | 1430 | goto response; |
1431 | 1431 | ||
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 30586ab9e878..266b6972667d 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -282,12 +282,12 @@ static struct proto rfcomm_proto = { | |||
282 | .obj_size = sizeof(struct rfcomm_pinfo) | 282 | .obj_size = sizeof(struct rfcomm_pinfo) |
283 | }; | 283 | }; |
284 | 284 | ||
285 | static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, gfp_t prio) | 285 | static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio) |
286 | { | 286 | { |
287 | struct rfcomm_dlc *d; | 287 | struct rfcomm_dlc *d; |
288 | struct sock *sk; | 288 | struct sock *sk; |
289 | 289 | ||
290 | sk = sk_alloc(PF_BLUETOOTH, prio, &rfcomm_proto, 1); | 290 | sk = sk_alloc(net, PF_BLUETOOTH, prio, &rfcomm_proto, 1); |
291 | if (!sk) | 291 | if (!sk) |
292 | return NULL; | 292 | return NULL; |
293 | 293 | ||
@@ -323,7 +323,7 @@ static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, gfp_t prio | |||
323 | return sk; | 323 | return sk; |
324 | } | 324 | } |
325 | 325 | ||
326 | static int rfcomm_sock_create(struct socket *sock, int protocol) | 326 | static int rfcomm_sock_create(struct net *net, struct socket *sock, int protocol) |
327 | { | 327 | { |
328 | struct sock *sk; | 328 | struct sock *sk; |
329 | 329 | ||
@@ -336,7 +336,7 @@ static int rfcomm_sock_create(struct socket *sock, int protocol) | |||
336 | 336 | ||
337 | sock->ops = &rfcomm_sock_ops; | 337 | sock->ops = &rfcomm_sock_ops; |
338 | 338 | ||
339 | sk = rfcomm_sock_alloc(sock, protocol, GFP_ATOMIC); | 339 | sk = rfcomm_sock_alloc(net, sock, protocol, GFP_ATOMIC); |
340 | if (!sk) | 340 | if (!sk) |
341 | return -ENOMEM; | 341 | return -ENOMEM; |
342 | 342 | ||
@@ -868,7 +868,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc * | |||
868 | goto done; | 868 | goto done; |
869 | } | 869 | } |
870 | 870 | ||
871 | sk = rfcomm_sock_alloc(NULL, BTPROTO_RFCOMM, GFP_ATOMIC); | 871 | sk = rfcomm_sock_alloc(parent->sk_net, NULL, BTPROTO_RFCOMM, GFP_ATOMIC); |
872 | if (!sk) | 872 | if (!sk) |
873 | goto done; | 873 | goto done; |
874 | 874 | ||
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 3f5163e725ed..65b6fb1c4154 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -414,11 +414,11 @@ static struct proto sco_proto = { | |||
414 | .obj_size = sizeof(struct sco_pinfo) | 414 | .obj_size = sizeof(struct sco_pinfo) |
415 | }; | 415 | }; |
416 | 416 | ||
417 | static struct sock *sco_sock_alloc(struct socket *sock, int proto, gfp_t prio) | 417 | static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio) |
418 | { | 418 | { |
419 | struct sock *sk; | 419 | struct sock *sk; |
420 | 420 | ||
421 | sk = sk_alloc(PF_BLUETOOTH, prio, &sco_proto, 1); | 421 | sk = sk_alloc(net, PF_BLUETOOTH, prio, &sco_proto, 1); |
422 | if (!sk) | 422 | if (!sk) |
423 | return NULL; | 423 | return NULL; |
424 | 424 | ||
@@ -439,7 +439,7 @@ static struct sock *sco_sock_alloc(struct socket *sock, int proto, gfp_t prio) | |||
439 | return sk; | 439 | return sk; |
440 | } | 440 | } |
441 | 441 | ||
442 | static int sco_sock_create(struct socket *sock, int protocol) | 442 | static int sco_sock_create(struct net *net, struct socket *sock, int protocol) |
443 | { | 443 | { |
444 | struct sock *sk; | 444 | struct sock *sk; |
445 | 445 | ||
@@ -452,7 +452,7 @@ static int sco_sock_create(struct socket *sock, int protocol) | |||
452 | 452 | ||
453 | sock->ops = &sco_sock_ops; | 453 | sock->ops = &sco_sock_ops; |
454 | 454 | ||
455 | sk = sco_sock_alloc(sock, protocol, GFP_ATOMIC); | 455 | sk = sco_sock_alloc(net, sock, protocol, GFP_ATOMIC); |
456 | if (!sk) | 456 | if (!sk) |
457 | return -ENOMEM; | 457 | return -ENOMEM; |
458 | 458 | ||
@@ -807,7 +807,7 @@ static void sco_conn_ready(struct sco_conn *conn) | |||
807 | 807 | ||
808 | bh_lock_sock(parent); | 808 | bh_lock_sock(parent); |
809 | 809 | ||
810 | sk = sco_sock_alloc(NULL, BTPROTO_SCO, GFP_ATOMIC); | 810 | sk = sco_sock_alloc(parent->sk_net, NULL, BTPROTO_SCO, GFP_ATOMIC); |
811 | if (!sk) { | 811 | if (!sk) { |
812 | bh_unlock_sock(parent); | 812 | bh_unlock_sock(parent); |
813 | goto done; | 813 | goto done; |