aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:43:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:43:29 -0400
commitdb6d8c7a4027b48d797b369a53f8470aaeed7063 (patch)
treee140c104a89abc2154e1f41a7db8ebecbb6fa0b4 /fs
parent3a533374283aea50eab3976d8a6d30532175f009 (diff)
parentfb65a7c091529bfffb1262515252c0d0f6241c5c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (1232 commits) iucv: Fix bad merging. net_sched: Add size table for qdiscs net_sched: Add accessor function for packet length for qdiscs net_sched: Add qdisc_enqueue wrapper highmem: Export totalhigh_pages. ipv6 mcast: Omit redundant address family checks in ip6_mc_source(). net: Use standard structures for generic socket address structures. ipv6 netns: Make several "global" sysctl variables namespace aware. netns: Use net_eq() to compare net-namespaces for optimization. ipv6: remove unused macros from net/ipv6.h ipv6: remove unused parameter from ip6_ra_control tcp: fix kernel panic with listening_get_next tcp: Remove redundant checks when setting eff_sacks tcp: options clean up tcp: Fix MD5 signatures for non-linear skbs sctp: Update sctp global memory limit allocations. sctp: remove unnecessary byteshifting, calculate directly in big-endian sctp: Allow only 1 listening socket with SO_REUSEADDR sctp: Do not leak memory on multiple listen() calls sctp: Support ipv6only AF_INET6 sockets. ...
Diffstat (limited to 'fs')
-rw-r--r--fs/compat_ioctl.c114
-rw-r--r--fs/proc/proc_net.c32
2 files changed, 34 insertions, 112 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index c54eaab71a19..7b3a03c7c6a9 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -58,7 +58,6 @@
58#include <linux/syscalls.h> 58#include <linux/syscalls.h>
59#include <linux/i2c.h> 59#include <linux/i2c.h>
60#include <linux/i2c-dev.h> 60#include <linux/i2c-dev.h>
61#include <linux/wireless.h>
62#include <linux/atalk.h> 61#include <linux/atalk.h>
63#include <linux/loop.h> 62#include <linux/loop.h>
64 63
@@ -1759,64 +1758,6 @@ static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, unsigned long a
1759 return sys_ioctl(fd, cmd, (unsigned long)tdata); 1758 return sys_ioctl(fd, cmd, (unsigned long)tdata);
1760} 1759}
1761 1760
1762struct compat_iw_point {
1763 compat_caddr_t pointer;
1764 __u16 length;
1765 __u16 flags;
1766};
1767
1768static int do_wireless_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
1769{
1770 struct iwreq __user *iwr;
1771 struct iwreq __user *iwr_u;
1772 struct iw_point __user *iwp;
1773 struct compat_iw_point __user *iwp_u;
1774 compat_caddr_t pointer_u;
1775 void __user *pointer;
1776 __u16 length, flags;
1777 int ret;
1778
1779 iwr_u = compat_ptr(arg);
1780 iwp_u = (struct compat_iw_point __user *) &iwr_u->u.data;
1781 iwr = compat_alloc_user_space(sizeof(*iwr));
1782 if (iwr == NULL)
1783 return -ENOMEM;
1784
1785 iwp = &iwr->u.data;
1786
1787 if (!access_ok(VERIFY_WRITE, iwr, sizeof(*iwr)))
1788 return -EFAULT;
1789
1790 if (__copy_in_user(&iwr->ifr_ifrn.ifrn_name[0],
1791 &iwr_u->ifr_ifrn.ifrn_name[0],
1792 sizeof(iwr->ifr_ifrn.ifrn_name)))
1793 return -EFAULT;
1794
1795 if (__get_user(pointer_u, &iwp_u->pointer) ||
1796 __get_user(length, &iwp_u->length) ||
1797 __get_user(flags, &iwp_u->flags))
1798 return -EFAULT;
1799
1800 if (__put_user(compat_ptr(pointer_u), &iwp->pointer) ||
1801 __put_user(length, &iwp->length) ||
1802 __put_user(flags, &iwp->flags))
1803 return -EFAULT;
1804
1805 ret = sys_ioctl(fd, cmd, (unsigned long) iwr);
1806
1807 if (__get_user(pointer, &iwp->pointer) ||
1808 __get_user(length, &iwp->length) ||
1809 __get_user(flags, &iwp->flags))
1810 return -EFAULT;
1811
1812 if (__put_user(ptr_to_compat(pointer), &iwp_u->pointer) ||
1813 __put_user(length, &iwp_u->length) ||
1814 __put_user(flags, &iwp_u->flags))
1815 return -EFAULT;
1816
1817 return ret;
1818}
1819
1820/* Since old style bridge ioctl's endup using SIOCDEVPRIVATE 1761/* Since old style bridge ioctl's endup using SIOCDEVPRIVATE
1821 * for some operations; this forces use of the newer bridge-utils that 1762 * for some operations; this forces use of the newer bridge-utils that
1822 * use compatiable ioctls 1763 * use compatiable ioctls
@@ -2405,6 +2346,7 @@ COMPATIBLE_IOCTL(HCIGETDEVLIST)
2405COMPATIBLE_IOCTL(HCIGETDEVINFO) 2346COMPATIBLE_IOCTL(HCIGETDEVINFO)
2406COMPATIBLE_IOCTL(HCIGETCONNLIST) 2347COMPATIBLE_IOCTL(HCIGETCONNLIST)
2407COMPATIBLE_IOCTL(HCIGETCONNINFO) 2348COMPATIBLE_IOCTL(HCIGETCONNINFO)
2349COMPATIBLE_IOCTL(HCIGETAUTHINFO)
2408COMPATIBLE_IOCTL(HCISETRAW) 2350COMPATIBLE_IOCTL(HCISETRAW)
2409COMPATIBLE_IOCTL(HCISETSCAN) 2351COMPATIBLE_IOCTL(HCISETSCAN)
2410COMPATIBLE_IOCTL(HCISETAUTH) 2352COMPATIBLE_IOCTL(HCISETAUTH)
@@ -2501,36 +2443,6 @@ COMPATIBLE_IOCTL(I2C_TENBIT)
2501COMPATIBLE_IOCTL(I2C_PEC) 2443COMPATIBLE_IOCTL(I2C_PEC)
2502COMPATIBLE_IOCTL(I2C_RETRIES) 2444COMPATIBLE_IOCTL(I2C_RETRIES)
2503COMPATIBLE_IOCTL(I2C_TIMEOUT) 2445COMPATIBLE_IOCTL(I2C_TIMEOUT)
2504/* wireless */
2505COMPATIBLE_IOCTL(SIOCSIWCOMMIT)
2506COMPATIBLE_IOCTL(SIOCGIWNAME)
2507COMPATIBLE_IOCTL(SIOCSIWNWID)
2508COMPATIBLE_IOCTL(SIOCGIWNWID)
2509COMPATIBLE_IOCTL(SIOCSIWFREQ)
2510COMPATIBLE_IOCTL(SIOCGIWFREQ)
2511COMPATIBLE_IOCTL(SIOCSIWMODE)
2512COMPATIBLE_IOCTL(SIOCGIWMODE)
2513COMPATIBLE_IOCTL(SIOCSIWSENS)
2514COMPATIBLE_IOCTL(SIOCGIWSENS)
2515COMPATIBLE_IOCTL(SIOCSIWRANGE)
2516COMPATIBLE_IOCTL(SIOCSIWPRIV)
2517COMPATIBLE_IOCTL(SIOCSIWSTATS)
2518COMPATIBLE_IOCTL(SIOCSIWAP)
2519COMPATIBLE_IOCTL(SIOCGIWAP)
2520COMPATIBLE_IOCTL(SIOCSIWRATE)
2521COMPATIBLE_IOCTL(SIOCGIWRATE)
2522COMPATIBLE_IOCTL(SIOCSIWRTS)
2523COMPATIBLE_IOCTL(SIOCGIWRTS)
2524COMPATIBLE_IOCTL(SIOCSIWFRAG)
2525COMPATIBLE_IOCTL(SIOCGIWFRAG)
2526COMPATIBLE_IOCTL(SIOCSIWTXPOW)
2527COMPATIBLE_IOCTL(SIOCGIWTXPOW)
2528COMPATIBLE_IOCTL(SIOCSIWRETRY)
2529COMPATIBLE_IOCTL(SIOCGIWRETRY)
2530COMPATIBLE_IOCTL(SIOCSIWPOWER)
2531COMPATIBLE_IOCTL(SIOCGIWPOWER)
2532COMPATIBLE_IOCTL(SIOCSIWAUTH)
2533COMPATIBLE_IOCTL(SIOCGIWAUTH)
2534/* hiddev */ 2446/* hiddev */
2535COMPATIBLE_IOCTL(HIDIOCGVERSION) 2447COMPATIBLE_IOCTL(HIDIOCGVERSION)
2536COMPATIBLE_IOCTL(HIDIOCAPPLICATION) 2448COMPATIBLE_IOCTL(HIDIOCAPPLICATION)
@@ -2761,29 +2673,7 @@ COMPATIBLE_IOCTL(USBDEVFS_IOCTL32)
2761HANDLE_IOCTL(I2C_FUNCS, w_long) 2673HANDLE_IOCTL(I2C_FUNCS, w_long)
2762HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl) 2674HANDLE_IOCTL(I2C_RDWR, do_i2c_rdwr_ioctl)
2763HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl) 2675HANDLE_IOCTL(I2C_SMBUS, do_i2c_smbus_ioctl)
2764/* wireless */ 2676/* bridge */
2765HANDLE_IOCTL(SIOCGIWRANGE, do_wireless_ioctl)
2766HANDLE_IOCTL(SIOCGIWPRIV, do_wireless_ioctl)
2767HANDLE_IOCTL(SIOCGIWSTATS, do_wireless_ioctl)
2768HANDLE_IOCTL(SIOCSIWSPY, do_wireless_ioctl)
2769HANDLE_IOCTL(SIOCGIWSPY, do_wireless_ioctl)
2770HANDLE_IOCTL(SIOCSIWTHRSPY, do_wireless_ioctl)
2771HANDLE_IOCTL(SIOCGIWTHRSPY, do_wireless_ioctl)
2772HANDLE_IOCTL(SIOCSIWMLME, do_wireless_ioctl)
2773HANDLE_IOCTL(SIOCGIWAPLIST, do_wireless_ioctl)
2774HANDLE_IOCTL(SIOCSIWSCAN, do_wireless_ioctl)
2775HANDLE_IOCTL(SIOCGIWSCAN, do_wireless_ioctl)
2776HANDLE_IOCTL(SIOCSIWESSID, do_wireless_ioctl)
2777HANDLE_IOCTL(SIOCGIWESSID, do_wireless_ioctl)
2778HANDLE_IOCTL(SIOCSIWNICKN, do_wireless_ioctl)
2779HANDLE_IOCTL(SIOCGIWNICKN, do_wireless_ioctl)
2780HANDLE_IOCTL(SIOCSIWENCODE, do_wireless_ioctl)
2781HANDLE_IOCTL(SIOCGIWENCODE, do_wireless_ioctl)
2782HANDLE_IOCTL(SIOCSIWGENIE, do_wireless_ioctl)
2783HANDLE_IOCTL(SIOCGIWGENIE, do_wireless_ioctl)
2784HANDLE_IOCTL(SIOCSIWENCODEEXT, do_wireless_ioctl)
2785HANDLE_IOCTL(SIOCGIWENCODEEXT, do_wireless_ioctl)
2786HANDLE_IOCTL(SIOCSIWPMKSA, do_wireless_ioctl)
2787HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl) 2677HANDLE_IOCTL(SIOCSIFBR, old_bridge_ioctl)
2788HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl) 2678HANDLE_IOCTL(SIOCGIFBR, old_bridge_ioctl)
2789/* Not implemented in the native kernel */ 2679/* Not implemented in the native kernel */
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 83f357b30d71..b224a28e0c15 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -51,6 +51,30 @@ int seq_open_net(struct inode *ino, struct file *f,
51} 51}
52EXPORT_SYMBOL_GPL(seq_open_net); 52EXPORT_SYMBOL_GPL(seq_open_net);
53 53
54int single_open_net(struct inode *inode, struct file *file,
55 int (*show)(struct seq_file *, void *))
56{
57 int err;
58 struct net *net;
59
60 err = -ENXIO;
61 net = get_proc_net(inode);
62 if (net == NULL)
63 goto err_net;
64
65 err = single_open(file, show, net);
66 if (err < 0)
67 goto err_open;
68
69 return 0;
70
71err_open:
72 put_net(net);
73err_net:
74 return err;
75}
76EXPORT_SYMBOL_GPL(single_open_net);
77
54int seq_release_net(struct inode *ino, struct file *f) 78int seq_release_net(struct inode *ino, struct file *f)
55{ 79{
56 struct seq_file *seq; 80 struct seq_file *seq;
@@ -63,6 +87,14 @@ int seq_release_net(struct inode *ino, struct file *f)
63} 87}
64EXPORT_SYMBOL_GPL(seq_release_net); 88EXPORT_SYMBOL_GPL(seq_release_net);
65 89
90int single_release_net(struct inode *ino, struct file *f)
91{
92 struct seq_file *seq = f->private_data;
93 put_net(seq->private);
94 return single_release(ino, f);
95}
96EXPORT_SYMBOL_GPL(single_release_net);
97
66static struct net *get_proc_task_net(struct inode *dir) 98static struct net *get_proc_task_net(struct inode *dir)
67{ 99{
68 struct task_struct *task; 100 struct task_struct *task;