: wext: Dispatch and handle compat ioctls entirely in net/wireless/wext.c
Subsystems (5)
David Miller
maintainerPATCH 9/12 : wext: Dispatch and handle compat ioctls entirely in net/wireless/wext.c
wext: Dispatch and handle compat ioctls entirely in net/wireless/wext.c
Next we can kill the hacks in fs/compat_ioctl.c and also dispatch compat ioctls down into the driver and 80211 protocol helper layers in order to handle iw_point objects embedded in stream replies which need to be translated.
Signed-off-by David S. Miller <[email protected]>
--- fs/compat_ioctl.c | 6 --- include/linux/wireless.h | 13 ++++++ include/net/wext.h | 7 +++ net/socket.c | 10 ++++ net/wireless/wext.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 134 insertions(+), 6 deletions(-)
fs/compat_ioctl.c +0 -6
@@ -1757,12 +1757,6 @@ static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, unsigned long areturn sys_ioctl (fd, cmd, (unsigned long )tdata); } -struct compat_iw_point { -compat_caddr_t pointer; -__u16 length; -__u16 flags; -}; -static int do_wireless_ioctl (unsigned int fd,unsigned int cmd,unsigned long arg) {struct iwreq __user *iwr;
include/linux/wireless.h +13 -0
@@ -677,6 +677,19 @@ struct iw_point__u16 flags;/* Optional params */ }; +#ifdef __KERNEL__ +#ifdef CONFIG_COMPAT + +#include <linux/compat.h> + +struct compat_iw_point { +compat_caddr_t pointer; +__u16 length; +__u16 flags; +}; +#endif +#endif +/* * A frequency * For numbers lower than 10^9, we encode the number in 'm' and
include/net/wext.h +7 -0
@@ -12,6 +12,8 @@ extern int wext_proc_init(struct net *net);extern void wext_proc_exit (struct net *net);extern int wext_handle_ioctl (struct net *net,struct ifreq *ifr,unsigned int cmd,void __user *arg); +extern int compat_wext_handle_ioctl (struct net *net,unsigned int cmd, +unsigned long arg);#else static inline int wext_proc_init (struct net *net) {
@@ -26,6 +28,11 @@ static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned {return -EINVAL ; } +static inline int compat_wext_handle_ioctl (struct net *net,unsigned int cmd, +unsigned long arg) +{ +return -EINVAL ; +}#endif #endif /* __NET_WEXT_H */
net/socket.c +10 -0
@@ -90,6 +90,7 @@#include <asm/unistd.h> #include <net/compat.h> +#include <net/wext.h> #include <net/sock.h> #include <linux/netfilter.h>
@@ -2210,10 +2211,19 @@ static long compat_sock_ioctl(struct file *file, unsigned cmd, {struct socket *sock = file->private_data;int ret = -ENOIOCTLCMD ; +struct sock *sk; +struct net *net; + + sk = sock->sk; + net =sock_net (sk);if (sock->ops->compat_ioctl) ret = sock->ops->compat_ioctl (sock, cmd, arg); +if (ret == -ENOIOCTLCMD && + (cmd >=SIOCIWFIRST && cmd <=SIOCIWLAST )) + ret =compat_wext_handle_ioctl (net, cmd, arg); +return ret; }#endif
net/wireless/wext.c +104 -0
110 lines not on this page · raw message
Signature · 1 line
1.5.5.1.308.g1fbb5