diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2002-09-03 00:49:04 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2002-09-03 00:49:04 -0700 |
| commit | 3d5fa36bf0c232f70db4bd15a50bbe322800bcdb (patch) | |
| tree | 5ada31234f00d9b893c77e713ef7a3e900550041 /net | |
| parent | 96ca2f806ceaf0f8fbde2548f51d6afc0a0fe7e3 (diff) | |
| parent | 1314cad1540faf6b81e455b2267ce23c2fa1d698 (diff) | |
Merge nuts.ninka.net:/home/davem/src/BK/network-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
Diffstat (limited to 'net')
| -rw-r--r-- | net/802/Makefile | 2 | ||||
| -rw-r--r-- | net/core/sock.c | 36 | ||||
| -rw-r--r-- | net/econet/af_econet.c | 7 | ||||
| -rw-r--r-- | net/ipv4/af_inet.c | 8 | ||||
| -rw-r--r-- | net/ipv4/netfilter/Makefile | 2 | ||||
| -rw-r--r-- | net/ipv4/tcp_input.c | 8 | ||||
| -rw-r--r-- | net/ipv4/tcp_minisocks.c | 1 | ||||
| -rw-r--r-- | net/ipv6/af_inet6.c | 9 | ||||
| -rw-r--r-- | net/ipx/Makefile | 2 | ||||
| -rw-r--r-- | net/packet/af_packet.c | 8 | ||||
| -rw-r--r-- | net/socket.c | 18 | ||||
| -rw-r--r-- | net/wanrouter/af_wanpipe.c | 8 | ||||
| -rw-r--r-- | net/x25/x25_in.c | 8 |
13 files changed, 21 insertions, 96 deletions
diff --git a/net/802/Makefile b/net/802/Makefile index cc21e2c476c0..0abaeaad1b7b 100644 --- a/net/802/Makefile +++ b/net/802/Makefile @@ -2,7 +2,7 @@ # Makefile for the Linux 802.x protocol layers. # -export-objs := p8022.o psnap.o tr.o +export-objs := p8022.o psnap.o obj-y := p8023.o diff --git a/net/core/sock.c b/net/core/sock.c index 0d5d04e0bdb3..07abf8bf43f4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -103,7 +103,6 @@ #include <linux/string.h> #include <linux/sockios.h> #include <linux/net.h> -#include <linux/fcntl.h> #include <linux/mm.h> #include <linux/slab.h> #include <linux/interrupt.h> @@ -1048,34 +1047,6 @@ int sock_no_getsockopt(struct socket *sock, int level, int optname, return -EOPNOTSUPP; } -/* - * Note: if you add something that sleeps here then change sock_fcntl() - * to do proper fd locking. - */ -int sock_no_fcntl(struct socket *sock, unsigned int cmd, unsigned long arg) -{ - struct sock *sk = sock->sk; - - switch(cmd) - { - case F_SETOWN: - /* - * This is a little restrictive, but it's the only - * way to make sure that you can't send a sigurg to - * another process. - */ - if (current->pgrp != -arg && - current->pid != arg && - !capable(CAP_KILL)) return(-EPERM); - sk->proc = arg; - return(0); - case F_GETOWN: - return(sk->proc); - default: - return(-EINVAL); - } -} - int sock_no_sendmsg(struct socket *sock, struct msghdr *m, int flags, struct scm_cookie *scm) { @@ -1179,6 +1150,13 @@ void sock_def_destruct(struct sock *sk) kfree(sk->protinfo); } +void sk_send_sigurg(struct sock *sk) +{ + if (sk->socket && sk->socket->file) + if (send_sigurg(&sk->socket->file->f_owner)) + sk_wake_async(sk, 3, POLL_PRI); +} + void sock_init_data(struct socket *sock, struct sock *sk) { skb_queue_head_init(&sk->receive_queue); diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 1034945a82b3..a40e27684219 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c @@ -651,13 +651,10 @@ static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg case SIOCSPGRP: if (get_user(pid, (int *) arg)) return -EFAULT; - if (current->pid != pid && current->pgrp != -pid && !capable(CAP_NET_ADMIN)) - return -EPERM; - sk->proc = pid; - return(0); + return f_setown(sock->file, pid, 1); case FIOGETOWN: case SIOCGPGRP: - return put_user(sk->proc, (int *)arg); + return put_user(sock->file->f_owner.pid, (int *)arg); case SIOCGSTAMP: if(sk->stamp.tv_sec==0) return -ENOENT; diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 2dcea8fd874c..37670ef9cf88 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -857,16 +857,12 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case SIOCSPGRP: if (get_user(pid, (int *)arg)) err = -EFAULT; - else if (current->pid != pid && - current->pgrp != -pid && - !capable(CAP_NET_ADMIN)) - err = -EPERM; else - sk->proc = pid; + err = f_setown(sock->file, pid, 1); break; case FIOGETOWN: case SIOCGPGRP: - err = put_user(sk->proc, (int *)arg); + err = put_user(sock->file->f_owner.pid, (int *)arg); break; case SIOCGSTAMP: if (!sk->stamp.tv_sec) diff --git a/net/ipv4/netfilter/Makefile b/net/ipv4/netfilter/Makefile index 38fd72287d16..452f0fd0658d 100644 --- a/net/ipv4/netfilter/Makefile +++ b/net/ipv4/netfilter/Makefile @@ -2,7 +2,7 @@ # Makefile for the netfilter modules on top of IPv4. # -export-objs := ip_conntrack_standalone.o ip_fw_compat.o ip_nat_standalone.o \ +export-objs := ip_conntrack_standalone.o ip_nat_standalone.o \ ip_tables.o arp_tables.o # objects for the conntrack and NAT core (used by standalone and backw. compat) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 97b867a086dd..7072ab51cf27 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3103,13 +3103,7 @@ static void tcp_check_urg(struct sock * sk, struct tcphdr * th) return; /* Tell the world about our new urgent pointer. */ - if (sk->proc != 0) { - if (sk->proc > 0) - kill_proc(sk->proc, SIGURG, 1); - else - kill_pg(-sk->proc, SIGURG, 1); - sk_wake_async(sk, 3, POLL_PRI); - } + sk_send_sigurg(sk); /* We may be adding urgent data when the last byte read was * urgent. To do this requires some care. We cannot just ignore diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 1404bdf390c8..5371c054796e 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -676,7 +676,6 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req, newsk->done = 0; newsk->userlocks = sk->userlocks & ~SOCK_BINDPORT_LOCK; - newsk->proc = 0; newsk->backlog.head = newsk->backlog.tail = NULL; newsk->callback_lock = RW_LOCK_UNLOCKED; skb_queue_head_init(&newsk->error_queue); diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index f917f1eef12b..4d5a98c77fc7 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -463,15 +463,10 @@ int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) case SIOCSPGRP: if (get_user(pid, (int *) arg)) return -EFAULT; - /* see sock_no_fcntl */ - if (current->pid != pid && current->pgrp != -pid && - !capable(CAP_NET_ADMIN)) - return -EPERM; - sk->proc = pid; - return(0); + return f_setown(sock->file, pid, 1); case FIOGETOWN: case SIOCGPGRP: - return put_user(sk->proc,(int *)arg); + return put_user(sock->file->f_owner.pid, (int *)arg); case SIOCGSTAMP: if(sk->stamp.tv_sec==0) return -ENOENT; diff --git a/net/ipx/Makefile b/net/ipx/Makefile index 5bf1385eabd9..0c40039074f3 100644 --- a/net/ipx/Makefile +++ b/net/ipx/Makefile @@ -2,8 +2,6 @@ # Makefile for the Linux IPX layer. # -export-objs = af_ipx.o - obj-$(CONFIG_IPX) += ipx.o ipx-y := af_ipx.o diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index edad9e2f8b7a..d6a74275f757 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -1463,15 +1463,11 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, int pid; if (get_user(pid, (int *) arg)) return -EFAULT; - if (current->pid != pid && current->pgrp != -pid && - !capable(CAP_NET_ADMIN)) - return -EPERM; - sk->proc = pid; - break; + return f_setown(sock->file, pid, 1); } case FIOGETOWN: case SIOCGPGRP: - return put_user(sk->proc, (int *)arg); + return put_user(sock->file->f_owner.pid, (int *)arg); case SIOCGSTAMP: if(sk->stamp.tv_sec==0) return -ENOENT; diff --git a/net/socket.c b/net/socket.c index c9be97e26a5e..cc08dc247e76 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1516,24 +1516,6 @@ out: return err; } - -/* - * Perform a file control on a socket file descriptor. - * - * Doesn't acquire a fd lock, because no network fcntl - * function sleeps currently. - */ - -int sock_fcntl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - struct socket *sock; - - sock = SOCKET_I (filp->f_dentry->d_inode); - if (sock && sock->ops) - return sock_no_fcntl(sock, cmd, arg); - return(-EINVAL); -} - /* Argument list sizes for sys_socketcall */ #define AL(x) ((x) * sizeof(unsigned long)) static unsigned char nargs[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c index cf585a136e29..5c9f18298921 100644 --- a/net/wanrouter/af_wanpipe.c +++ b/net/wanrouter/af_wanpipe.c @@ -1876,14 +1876,10 @@ static int wanpipe_ioctl(struct socket *sock, unsigned int cmd, unsigned long ar err = get_user(pid, (int *) arg); if (err) return err; - if (current->pid != pid && current->pgrp != -pid && - !capable(CAP_NET_ADMIN)) - return -EPERM; - sk->proc = pid; - return(0); + return f_setown(sock->file, pid, 1); case FIOGETOWN: case SIOCGPGRP: - return put_user(sk->proc, (int *)arg); + return put_user(sock->file->f_owner.pid, (int *)arg); case SIOCGSTAMP: if(sk->stamp.tv_sec==0) return -ENOENT; diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c index 0df826f47c29..17d9b71d5324 100644 --- a/net/x25/x25_in.c +++ b/net/x25/x25_in.c @@ -283,13 +283,7 @@ static int x25_state3_machine(struct sock *sk, struct sk_buff *skb, int frametyp skb_queue_tail(&x25->interrupt_in_queue, skb); queued = 1; } - if (sk->proc != 0) { - if (sk->proc > 0) - kill_proc(sk->proc, SIGURG, 1); - else - kill_pg(-sk->proc, SIGURG, 1); - sock_wake_async(sk->socket, 3, POLL_PRI); - } + sk_send_sigurg(sk); x25_write_internal(sk, X25_INTERRUPT_CONFIRMATION); break; |
