]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net/compat.c,linux/filter.h: share compat_sock_fprog
authorWill Drewry <wad@chromium.org>
Thu, 12 Apr 2012 21:47:53 +0000 (16:47 -0500)
committerJames Morris <james.l.morris@oracle.com>
Sat, 14 Apr 2012 01:13:19 +0000 (11:13 +1000)
Any other users of bpf_*_filter that take a struct sock_fprog from
userspace will need to be able to also accept a compat_sock_fprog
if the arch supports compat calls.  This change allows the existing
compat_sock_fprog be shared.

Signed-off-by: Will Drewry <wad@chromium.org>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Eric Paris <eparis@redhat.com>
v18: tasered by the apostrophe police
v14: rebase/nochanges
v13: rebase on to 88ebdda6159ffc15699f204c33feb3e431bf9bdc
v12: rebase on to linux-next
v11: introduction
Signed-off-by: James Morris <james.l.morris@oracle.com>
include/linux/filter.h
net/compat.c

index aaa2e80630b8be7c3d1f922e0945692e9ab1aaba..f2e53152e835c91dab568cac58b69fcf2c555851 100644 (file)
@@ -10,6 +10,7 @@
 
 #ifdef __KERNEL__
 #include <linux/atomic.h>
+#include <linux/compat.h>
 #endif
 
 /*
@@ -132,6 +133,16 @@ struct sock_fprog {        /* Required for SO_ATTACH_FILTER. */
 
 #ifdef __KERNEL__
 
+#ifdef CONFIG_COMPAT
+/*
+ * A struct sock_filter is architecture independent.
+ */
+struct compat_sock_fprog {
+       u16             len;
+       compat_uptr_t   filter;         /* struct sock_filter * */
+};
+#endif
+
 struct sk_buff;
 struct sock;
 
index e055708b8ec9dfaa894e8e5920b4c35fd38b2afe..242c828810ff935c4539bebf5eeba6522f1853a9 100644 (file)
@@ -328,14 +328,6 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm)
        __scm_destroy(scm);
 }
 
-/*
- * A struct sock_filter is architecture independent.
- */
-struct compat_sock_fprog {
-       u16             len;
-       compat_uptr_t   filter;         /* struct sock_filter * */
-};
-
 static int do_set_attach_filter(struct socket *sock, int level, int optname,
                                char __user *optval, unsigned int optlen)
 {