diff options
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/net/socket.c b/net/socket.c index 118a7276b..e53d74252 100644 --- a/net/socket.c +++ b/net/socket.c @@ -55,17 +55,9 @@ */ #include <linux/config.h> -#include <linux/signal.h> -#include <linux/errno.h> -#include <linux/sched.h> #include <linux/mm.h> -#include <linux/smp.h> #include <linux/smp_lock.h> -#include <linux/kernel.h> -#include <linux/major.h> -#include <linux/stat.h> #include <linux/socket.h> -#include <linux/fcntl.h> #include <linux/file.h> #include <linux/net.h> #include <linux/interrupt.h> @@ -80,20 +72,17 @@ #include <linux/kmod.h> #endif -#include <asm/system.h> #include <asm/uaccess.h> #include <linux/inet.h> #include <net/ip.h> -#include <net/protocol.h> +#include <net/sock.h> #include <net/rarp.h> #include <net/tcp.h> #include <net/udp.h> -#include <linux/skbuff.h> -#include <net/sock.h> #include <net/scm.h> - +static int sock_no_open(struct inode *irrelevant, struct file *dontcare); static long long sock_lseek(struct file *file, long long offset, int whence); static ssize_t sock_read(struct file *file, char *buf, size_t size, loff_t *ppos); @@ -121,7 +110,7 @@ static struct file_operations socket_file_ops = { sock_poll, sock_ioctl, NULL, /* mmap */ - NULL, /* no special open code... */ + sock_no_open, /* special open code to disallow open via /proc */ NULL, /* flush */ sock_close, NULL, /* no fsync */ @@ -305,6 +294,17 @@ struct socket *sock_alloc(void) return sock; } +/* + * In theory you can't get an open on this inode, but /proc provides + * a back door. Remember to keep it shut otherwise you'll let the + * creepy crawlies in. + */ + +static int sock_no_open(struct inode *irrelevant, struct file *dontcare) +{ + return -ENXIO; +} + void sock_release(struct socket *sock) { if (sock->state != SS_UNCONNECTED) |