summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2002-09-02 22:41:02 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-09-02 22:41:02 -0700
commit2a3f7d0618a6ae0e54e00c5f046b3ffe8899bfdd (patch)
treea068286cb759edfb99a69fc1732ca43b498aa6cd
parenteca56747e1b2f7d2ad2bf11da5b896ce9497279b (diff)
parent1add9f7a56e43099c23f6ba9409278116ea1c964 (diff)
Merge home.transmeta.com:/home/torvalds/v2.5/linux
into home.transmeta.com:/home/torvalds/v2.5/sigio
-rw-r--r--drivers/char/tty_io.c12
-rw-r--r--drivers/net/tun.c8
-rw-r--r--fs/Makefile3
-rw-r--r--fs/dnotify.c24
-rw-r--r--fs/fcntl.c120
-rw-r--r--fs/file_table.c1
-rw-r--r--fs/locks.c12
-rw-r--r--include/linux/fs.h5
-rw-r--r--include/net/inet_common.h3
-rw-r--r--include/net/sock.h5
-rw-r--r--kernel/futex.c11
-rw-r--r--net/core/sock.c36
-rw-r--r--net/econet/af_econet.c7
-rw-r--r--net/ipv4/af_inet.c8
-rw-r--r--net/ipv4/tcp_input.c8
-rw-r--r--net/ipv4/tcp_minisocks.c1
-rw-r--r--net/ipv6/af_inet6.c9
-rw-r--r--net/packet/af_packet.c8
-rw-r--r--net/socket.c18
-rw-r--r--net/wanrouter/af_wanpipe.c8
-rw-r--r--net/x25/x25_in.c8
21 files changed, 147 insertions, 168 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 370317b2104b..ddc37ef904c6 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1458,15 +1458,9 @@ static int tty_fasync(int fd, struct file * filp, int on)
if (on) {
if (!waitqueue_active(&tty->read_wait))
tty->minimum_to_wake = 1;
- if (filp->f_owner.pid == 0) {
- retval = security_ops->file_set_fowner(filp);
- if (retval)
- return retval;
-
- filp->f_owner.pid = (-tty->pgrp) ? : current->pid;
- filp->f_owner.uid = current->uid;
- filp->f_owner.euid = current->euid;
- }
+ retval = f_setown(filp, (-tty->pgrp) ? : current->pid, 0);
+ if (retval)
+ return retval;
} else {
if (!tty->fasync && !waitqueue_active(&tty->read_wait))
tty->minimum_to_wake = N_TTY_BUF_SIZE;
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7e5ffd0211bd..91b88a1cd0f5 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -513,12 +513,10 @@ static int tun_chr_fasync(int fd, struct file *file, int on)
return ret;
if (on) {
+ ret = f_setown(file, current->pid, 0);
+ if (ret)
+ return ret;
tun->flags |= TUN_FASYNC;
- if (!file->f_owner.pid) {
- file->f_owner.pid = current->pid;
- file->f_owner.uid = current->uid;
- file->f_owner.euid = current->euid;
- }
} else
tun->flags &= ~TUN_FASYNC;
diff --git a/fs/Makefile b/fs/Makefile
index 810e4af0f0a2..1a2f9a2dc9e6 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -7,7 +7,8 @@
O_TARGET := fs.o
-export-objs := open.o dcache.o buffer.o bio.o inode.o dquot.o mpage.o aio.o
+export-objs := open.o dcache.o buffer.o bio.o inode.o dquot.o mpage.o aio.o \
+ fcntl.o
obj-y := open.o read_write.o devices.o file_table.o buffer.o \
bio.o super.o block_dev.o char_dev.o stat.o exec.o pipe.o \
diff --git a/fs/dnotify.c b/fs/dnotify.c
index 5efe642266b9..4979e1055e5c 100644
--- a/fs/dnotify.c
+++ b/fs/dnotify.c
@@ -68,7 +68,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
struct dnotify_struct **prev;
struct inode *inode;
fl_owner_t id = current->files;
- int error;
+ int error = 0;
if ((arg & ~DN_MULTISHOT) == 0) {
dnotify_flush(filp, id);
@@ -89,21 +89,15 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
odn->dn_fd = fd;
odn->dn_mask |= arg;
inode->i_dnotify_mask |= arg & ~DN_MULTISHOT;
- kmem_cache_free(dn_cache, dn);
- goto out;
+ goto out_free;
}
prev = &odn->dn_next;
}
- error = security_ops->file_set_fowner(filp);
- if (error) {
- write_unlock(&dn_lock);
- return error;
- }
+ error = f_setown(filp, current->pid, 1);
+ if (error)
+ goto out_free;
- filp->f_owner.pid = current->pid;
- filp->f_owner.uid = current->uid;
- filp->f_owner.euid = current->euid;
dn->dn_mask = arg;
dn->dn_fd = fd;
dn->dn_filp = filp;
@@ -113,7 +107,10 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
inode->i_dnotify = dn;
out:
write_unlock(&dn_lock);
- return 0;
+ return error;
+out_free:
+ kmem_cache_free(dn_cache, dn);
+ goto out;
}
void __inode_dir_notify(struct inode *inode, unsigned long event)
@@ -131,8 +128,7 @@ void __inode_dir_notify(struct inode *inode, unsigned long event)
continue;
}
fown = &dn->dn_filp->f_owner;
- if (fown->pid)
- send_sigio(fown, dn->dn_fd, POLL_MSG);
+ send_sigio(fown, dn->dn_fd, POLL_MSG);
if (dn->dn_mask & DN_MULTISHOT)
prev = &dn->dn_next;
else {
diff --git a/fs/fcntl.c b/fs/fcntl.c
index b26bdbcb2930..c68baf1f81da 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -11,13 +11,13 @@
#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/iobuf.h>
+#include <linux/module.h>
#include <linux/security.h>
#include <asm/poll.h>
#include <asm/siginfo.h>
#include <asm/uaccess.h>
-extern int sock_fcntl (struct file *, unsigned int cmd, unsigned long arg);
extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg);
extern int fcntl_getlease(struct file *filp);
@@ -259,6 +259,35 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
return error;
}
+static void f_modown(struct file *filp, unsigned long pid,
+ uid_t uid, uid_t euid, int force)
+{
+ write_lock_irq(&filp->f_owner.lock);
+ if (force || !filp->f_owner.pid) {
+ filp->f_owner.pid = pid;
+ filp->f_owner.uid = uid;
+ filp->f_owner.euid = euid;
+ }
+ write_unlock_irq(&filp->f_owner.lock);
+}
+
+int f_setown(struct file *filp, unsigned long arg, int force)
+{
+ int err;
+
+ err = security_ops->file_set_fowner(filp);
+ if (err)
+ return err;
+
+ f_modown(filp, arg, current->uid, current->euid, force);
+ return 0;
+}
+
+void f_delown(struct file *filp)
+{
+ f_modown(filp, 0, 0, 0, 1);
+}
+
static long do_fcntl(unsigned int fd, unsigned int cmd,
unsigned long arg, struct file * filp)
{
@@ -302,21 +331,7 @@ static long do_fcntl(unsigned int fd, unsigned int cmd,
err = filp->f_owner.pid;
break;
case F_SETOWN:
- lock_kernel();
-
- err = security_ops->file_set_fowner(filp);
- if (err) {
- unlock_kernel();
- break;
- }
-
- filp->f_owner.pid = arg;
- filp->f_owner.uid = current->uid;
- filp->f_owner.euid = current->euid;
- err = 0;
- if (S_ISSOCK (filp->f_dentry->d_inode->i_mode))
- err = sock_fcntl (filp, F_SETOWN, arg);
- unlock_kernel();
+ err = f_setown(filp, arg, 1);
break;
case F_GETSIG:
err = filp->f_owner.signum;
@@ -339,10 +354,6 @@ static long do_fcntl(unsigned int fd, unsigned int cmd,
err = fcntl_dirnotify(fd, filp, arg);
break;
default:
- /* sockets need a few special fcntls. */
- err = -EINVAL;
- if (S_ISSOCK (filp->f_dentry->d_inode->i_mode))
- err = sock_fcntl (filp, cmd, arg);
break;
}
@@ -418,14 +429,20 @@ static long band_table[NSIGPOLL] = {
POLLHUP | POLLERR /* POLL_HUP */
};
+static inline int sigio_perm(struct task_struct *p,
+ struct fown_struct *fown)
+{
+ return ((fown->euid == 0) ||
+ (fown->euid == p->suid) || (fown->euid == p->uid) ||
+ (fown->uid == p->suid) || (fown->uid == p->uid));
+}
+
static void send_sigio_to_task(struct task_struct *p,
struct fown_struct *fown,
int fd,
int reason)
{
- if ((fown->euid != 0) &&
- (fown->euid ^ p->suid) && (fown->euid ^ p->uid) &&
- (fown->uid ^ p->suid) && (fown->uid ^ p->uid))
+ if (!sigio_perm(p, fown))
return;
if (security_ops->file_send_sigiotask(p, fown, fd, reason))
@@ -464,12 +481,17 @@ static void send_sigio_to_task(struct task_struct *p,
void send_sigio(struct fown_struct *fown, int fd, int band)
{
struct task_struct * p;
- int pid = fown->pid;
+ int pid;
+
+ read_lock(&fown->lock);
+ pid = fown->pid;
+ if (!pid)
+ goto out_unlock_fown;
read_lock(&tasklist_lock);
if ( (pid > 0) && (p = find_task_by_pid(pid)) ) {
send_sigio_to_task(p, fown, fd, band);
- goto out;
+ goto out_unlock_task;
}
for_each_task(p) {
int match = p->pid;
@@ -479,8 +501,49 @@ void send_sigio(struct fown_struct *fown, int fd, int band)
continue;
send_sigio_to_task(p, fown, fd, band);
}
-out:
+out_unlock_task:
read_unlock(&tasklist_lock);
+out_unlock_fown:
+ read_unlock(&fown->lock);
+}
+
+static void send_sigurg_to_task(struct task_struct *p,
+ struct fown_struct *fown)
+{
+ if (sigio_perm(p, fown))
+ send_sig(SIGURG, p, 1);
+}
+
+int send_sigurg(struct fown_struct *fown)
+{
+ struct task_struct *p;
+ int pid, ret = 0;
+
+ read_lock(&fown->lock);
+ pid = fown->pid;
+ if (!pid)
+ goto out_unlock_fown;
+
+ ret = 1;
+
+ read_lock(&tasklist_lock);
+ if ((pid > 0) && (p = find_task_by_pid(pid))) {
+ send_sigurg_to_task(p, fown);
+ goto out_unlock_task;
+ }
+ for_each_task(p) {
+ int match = p->pid;
+ if (pid < 0)
+ match = -p->pgrp;
+ if (pid != match)
+ continue;
+ send_sigurg_to_task(p, fown);
+ }
+out_unlock_task:
+ read_unlock(&tasklist_lock);
+out_unlock_fown:
+ read_unlock(&fown->lock);
+ return ret;
}
static rwlock_t fasync_lock = RW_LOCK_UNLOCKED;
@@ -543,7 +606,7 @@ void __kill_fasync(struct fasync_struct *fa, int sig, int band)
/* Don't send SIGURG to processes which have not set a
queued signum: SIGURG has its own default signalling
mechanism. */
- if (fown->pid && !(sig == SIGURG && fown->signum == 0))
+ if (!(sig == SIGURG && fown->signum == 0))
send_sigio(fown, fa->fa_fd, band);
fa = fa->fa_next;
}
@@ -566,3 +629,6 @@ static int __init fasync_init(void)
}
module_init(fasync_init)
+
+EXPORT_SYMBOL(f_setown);
+EXPORT_SYMBOL(f_delown);
diff --git a/fs/file_table.c b/fs/file_table.c
index 26a00610fcee..e200cce0be37 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -54,6 +54,7 @@ struct file * get_empty_filp(void)
f->f_version = ++event;
f->f_uid = current->fsuid;
f->f_gid = current->fsgid;
+ f->f_owner.lock = RW_LOCK_UNLOCKED;
list_add(&f->f_list, &anon_list);
file_list_unlock();
return f;
diff --git a/fs/locks.c b/fs/locks.c
index 369988a6a403..a0461a42bc19 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -997,9 +997,7 @@ static int lease_modify(struct file_lock **before, int arg)
if (arg == F_UNLCK) {
struct file *filp = fl->fl_file;
- filp->f_owner.pid = 0;
- filp->f_owner.uid = 0;
- filp->f_owner.euid = 0;
+ f_delown(filp);
filp->f_owner.signum = 0;
locks_delete_lock(before);
}
@@ -1277,13 +1275,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
*before = fl;
list_add(&fl->fl_link, &file_lock_list);
- error = security_ops->file_set_fowner(filp);
- if (error)
- goto out_unlock;
-
- filp->f_owner.pid = current->pid;
- filp->f_owner.uid = current->uid;
- filp->f_owner.euid = current->euid;
+ error = f_setown(filp, current->pid, 1);
out_unlock:
unlock_kernel();
return error;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 598561bc18c2..befc2bbb5f3c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -432,6 +432,7 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
#include <linux/efs_fs_i.h>
struct fown_struct {
+ rwlock_t lock; /* protects pid, uid, euid fields */
int pid; /* pid or -pgrp where SIGIO should be sent */
uid_t uid, euid; /* uid/euid of process setting the owner */
int signum; /* posix.1b rt signal to be delivered on IO */
@@ -615,6 +616,10 @@ extern void kill_fasync(struct fasync_struct **, int, int);
/* only for net: no internal synchronization */
extern void __kill_fasync(struct fasync_struct *, int, int);
+extern int f_setown(struct file *filp, unsigned long arg, int force);
+extern void f_delown(struct file *filp);
+extern int send_sigurg(struct fown_struct *fown);
+
/*
* Umount options
*/
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index bbb1fa70099e..3dcab5199cc1 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -34,9 +34,6 @@ extern int inet_setsockopt(struct socket *sock, int level,
extern int inet_getsockopt(struct socket *sock, int level,
int optname, char *optval,
int *optlen);
-extern int inet_fcntl(struct socket *sock,
- unsigned int cmd,
- unsigned long arg);
extern int inet_listen(struct socket *sock, int backlog);
extern void inet_sock_release(struct sock *sk);
diff --git a/include/net/sock.h b/include/net/sock.h
index ccf82ecab360..da47601e4290 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -132,7 +132,6 @@ struct sock {
unsigned char rcvtstamp;
unsigned char no_largesend;
int route_caps;
- int proc;
unsigned long lingertime;
int hashent;
@@ -292,7 +291,6 @@ static __inline__ void sock_prot_dec_use(struct proto *prot)
#define SOCK_BINDADDR_LOCK 4
#define SOCK_BINDPORT_LOCK 8
-#include <linux/fs.h> /* just for inode - yeuch.*/
/* Used by processes to "lock" a socket state, so that
@@ -362,6 +360,7 @@ extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
int *errcode);
extern void *sock_kmalloc(struct sock *sk, int size, int priority);
extern void sock_kfree_s(struct sock *sk, void *mem, int size);
+extern void sk_send_sigurg(struct sock *sk);
/*
* Functions to fill in entries in struct proto_ops when a protocol
@@ -388,8 +387,6 @@ extern int sock_no_getsockopt(struct socket *, int , int,
char *, int *);
extern int sock_no_setsockopt(struct socket *, int, int,
char *, int);
-extern int sock_no_fcntl(struct socket *,
- unsigned int, unsigned long);
extern int sock_no_sendmsg(struct socket *,
struct msghdr *, int,
struct scm_cookie *);
diff --git a/kernel/futex.c b/kernel/futex.c
index ef3dc8b00a5f..ac9fda58181e 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -276,9 +276,14 @@ static int futex_fd(struct list_head *head,
filp->f_dentry = dget(futex_mnt->mnt_root);
if (signal) {
- filp->f_owner.pid = current->tgid;
- filp->f_owner.uid = current->uid;
- filp->f_owner.euid = current->euid;
+ int ret;
+
+ ret = f_setown(filp, current->tgid, 1);
+ if (ret) {
+ put_unused_fd(fd);
+ put_filp(filp);
+ return ret;
+ }
filp->f_owner.signum = signal;
}
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/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/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;