net: pass kern to net_proto_family create function

The generic __sock_create function has a kern argument which allows the
security system to make decisions based on if a socket is being created by
the kernel or by userspace.  This patch passes that flag to the
net_proto_family specific create function, so it can do the same thing.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Paris
2009-11-05 22:18:14 -08:00
committed by David S. Miller
parent 13f18aa05f
commit 3f378b6844
37 changed files with 80 additions and 43 deletions
+1 -1
View File
@@ -779,7 +779,7 @@ base_sock_create(struct net *net, struct socket *sock, int protocol)
} }
static int static int
mISDN_sock_create(struct net *net, struct socket *sock, int proto) mISDN_sock_create(struct net *net, struct socket *sock, int proto, int kern)
{ {
int err = -EPROTONOSUPPORT; int err = -EPROTONOSUPPORT;
+2 -1
View File
@@ -104,7 +104,8 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
EXPORT_SYMBOL(pppox_ioctl); EXPORT_SYMBOL(pppox_ioctl);
static int pppox_create(struct net *net, struct socket *sock, int protocol) static int pppox_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
int rc = -EPROTOTYPE; int rc = -EPROTOTYPE;
+2 -1
View File
@@ -204,7 +204,8 @@ struct proto_ops {
struct net_proto_family { struct net_proto_family {
int family; int family;
int (*create)(struct net *net, struct socket *sock, int protocol); int (*create)(struct net *net, struct socket *sock,
int protocol, int kern);
struct module *owner; struct module *owner;
}; };
+2 -1
View File
@@ -1021,7 +1021,8 @@ static struct proto ddp_proto = {
* Create a socket. Initialise the socket, blank the addresses * Create a socket. Initialise the socket, blank the addresses
* set the state. * set the state.
*/ */
static int atalk_create(struct net *net, struct socket *sock, int protocol) static int atalk_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
int rc = -ESOCKTNOSUPPORT; int rc = -ESOCKTNOSUPPORT;
+2 -1
View File
@@ -127,7 +127,8 @@ static const struct proto_ops pvc_proto_ops = {
}; };
static int pvc_create(struct net *net, struct socket *sock,int protocol) static int pvc_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
if (net != &init_net) if (net != &init_net)
return -EAFNOSUPPORT; return -EAFNOSUPPORT;
+4 -3
View File
@@ -25,7 +25,7 @@
#include "signaling.h" #include "signaling.h"
#include "addr.h" #include "addr.h"
static int svc_create(struct net *net, struct socket *sock,int protocol); static int svc_create(struct net *net, struct socket *sock, int protocol, int kern);
/* /*
* Note: since all this is still nicely synchronized with the signaling demon, * Note: since all this is still nicely synchronized with the signaling demon,
@@ -330,7 +330,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags)
lock_sock(sk); lock_sock(sk);
error = svc_create(sock_net(sk), newsock,0); error = svc_create(sock_net(sk), newsock, 0, 0);
if (error) if (error)
goto out; goto out;
@@ -650,7 +650,8 @@ static const struct proto_ops svc_proto_ops = {
}; };
static int svc_create(struct net *net, struct socket *sock,int protocol) static int svc_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
int error; int error;
+2 -1
View File
@@ -799,7 +799,8 @@ static struct proto ax25_proto = {
.obj_size = sizeof(struct sock), .obj_size = sizeof(struct sock),
}; };
static int ax25_create(struct net *net, struct socket *sock, int protocol) static int ax25_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
ax25_cb *ax25; ax25_cb *ax25;
+3 -2
View File
@@ -126,7 +126,8 @@ int bt_sock_unregister(int proto)
} }
EXPORT_SYMBOL(bt_sock_unregister); EXPORT_SYMBOL(bt_sock_unregister);
static int bt_sock_create(struct net *net, struct socket *sock, int proto) static int bt_sock_create(struct net *net, struct socket *sock, int proto,
int kern)
{ {
int err; int err;
@@ -144,7 +145,7 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto)
read_lock(&bt_proto_lock); read_lock(&bt_proto_lock);
if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
err = bt_proto[proto]->create(net, sock, proto); err = bt_proto[proto]->create(net, sock, proto, kern);
bt_sock_reclassify_lock(sock, proto); bt_sock_reclassify_lock(sock, proto);
module_put(bt_proto[proto]->owner); module_put(bt_proto[proto]->owner);
} }
+2 -1
View File
@@ -195,7 +195,8 @@ static struct proto bnep_proto = {
.obj_size = sizeof(struct bt_sock) .obj_size = sizeof(struct bt_sock)
}; };
static int bnep_sock_create(struct net *net, struct socket *sock, int protocol) static int bnep_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
+2 -1
View File
@@ -190,7 +190,8 @@ static struct proto cmtp_proto = {
.obj_size = sizeof(struct bt_sock) .obj_size = sizeof(struct bt_sock)
}; };
static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol) static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
+2 -1
View File
@@ -621,7 +621,8 @@ static struct proto hci_sk_proto = {
.obj_size = sizeof(struct hci_pinfo) .obj_size = sizeof(struct hci_pinfo)
}; };
static int hci_sock_create(struct net *net, struct socket *sock, int protocol) static int hci_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
+2 -1
View File
@@ -241,7 +241,8 @@ static struct proto hidp_proto = {
.obj_size = sizeof(struct bt_sock) .obj_size = sizeof(struct bt_sock)
}; };
static int hidp_sock_create(struct net *net, struct socket *sock, int protocol) static int hidp_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
+2 -1
View File
@@ -819,7 +819,8 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int p
return sk; return sk;
} }
static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol) static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
+2 -1
View File
@@ -323,7 +323,8 @@ static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock, int
return sk; return sk;
} }
static int rfcomm_sock_create(struct net *net, struct socket *sock, int protocol) static int rfcomm_sock_create(struct net *net, struct socket *sock,
int protocol, int kern)
{ {
struct sock *sk; struct sock *sk;
+2 -1
View File
@@ -430,7 +430,8 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, int pro
return sk; return sk;
} }
static int sco_sock_create(struct net *net, struct socket *sock, int protocol) static int sco_sock_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
+2 -1
View File
@@ -114,7 +114,8 @@ static void can_sock_destruct(struct sock *sk)
skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_receive_queue);
} }
static int can_create(struct net *net, struct socket *sock, int protocol) static int can_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
struct can_proto *cp; struct can_proto *cp;
+2 -1
View File
@@ -675,7 +675,8 @@ char *dn_addr2asc(__u16 addr, char *buf)
static int dn_create(struct net *net, struct socket *sock, int protocol) static int dn_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
+2 -1
View File
@@ -605,7 +605,8 @@ static struct proto econet_proto = {
* Create an Econet socket * Create an Econet socket
*/ */
static int econet_create(struct net *net, struct socket *sock, int protocol) static int econet_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
struct econet_sock *eo; struct econet_sock *eo;
+1 -1
View File
@@ -234,7 +234,7 @@ static const struct proto_ops ieee802154_dgram_ops = {
* set the state. * set the state.
*/ */
static int ieee802154_create(struct net *net, struct socket *sock, static int ieee802154_create(struct net *net, struct socket *sock,
int protocol) int protocol, int kern)
{ {
struct sock *sk; struct sock *sk;
int rc; int rc;
+2 -1
View File
@@ -262,7 +262,8 @@ static inline int inet_netns_ok(struct net *net, int protocol)
* Create an inet socket. * Create an inet socket.
*/ */
static int inet_create(struct net *net, struct socket *sock, int protocol) static int inet_create(struct net *net, struct socket *sock, int protocol,
int kern)
{ {
struct sock *sk; struct sock *sk;
struct inet_protosw *answer; struct inet_protosw *answer;

Some files were not shown because too many files have changed in this diff Show More