diff options
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 219 |
1 files changed, 167 insertions, 52 deletions
diff --git a/net/socket.c b/net/socket.c index c2ed7c95ce87..02dc82db3d23 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -542,11 +542,10 @@ int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags) | |||
542 | } | 542 | } |
543 | EXPORT_SYMBOL(sock_tx_timestamp); | 543 | EXPORT_SYMBOL(sock_tx_timestamp); |
544 | 544 | ||
545 | static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock, | 545 | static inline int __sock_sendmsg_nosec(struct kiocb *iocb, struct socket *sock, |
546 | struct msghdr *msg, size_t size) | 546 | struct msghdr *msg, size_t size) |
547 | { | 547 | { |
548 | struct sock_iocb *si = kiocb_to_siocb(iocb); | 548 | struct sock_iocb *si = kiocb_to_siocb(iocb); |
549 | int err; | ||
550 | 549 | ||
551 | sock_update_classid(sock->sk); | 550 | sock_update_classid(sock->sk); |
552 | 551 | ||
@@ -555,13 +554,17 @@ static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
555 | si->msg = msg; | 554 | si->msg = msg; |
556 | si->size = size; | 555 | si->size = size; |
557 | 556 | ||
558 | err = security_socket_sendmsg(sock, msg, size); | ||
559 | if (err) | ||
560 | return err; | ||
561 | |||
562 | return sock->ops->sendmsg(iocb, sock, msg, size); | 557 | return sock->ops->sendmsg(iocb, sock, msg, size); |
563 | } | 558 | } |
564 | 559 | ||
560 | static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock, | ||
561 | struct msghdr *msg, size_t size) | ||
562 | { | ||
563 | int err = security_socket_sendmsg(sock, msg, size); | ||
564 | |||
565 | return err ?: __sock_sendmsg_nosec(iocb, sock, msg, size); | ||
566 | } | ||
567 | |||
565 | int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) | 568 | int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) |
566 | { | 569 | { |
567 | struct kiocb iocb; | 570 | struct kiocb iocb; |
@@ -577,6 +580,20 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) | |||
577 | } | 580 | } |
578 | EXPORT_SYMBOL(sock_sendmsg); | 581 | EXPORT_SYMBOL(sock_sendmsg); |
579 | 582 | ||
583 | int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg, size_t size) | ||
584 | { | ||
585 | struct kiocb iocb; | ||
586 | struct sock_iocb siocb; | ||
587 | int ret; | ||
588 | |||
589 | init_sync_kiocb(&iocb, NULL); | ||
590 | iocb.private = &siocb; | ||
591 | ret = __sock_sendmsg_nosec(&iocb, sock, msg, size); | ||
592 | if (-EIOCBQUEUED == ret) | ||
593 | ret = wait_on_sync_kiocb(&iocb); | ||
594 | return ret; | ||
595 | } | ||
596 | |||
580 | int kernel_sendmsg(struct socket *sock, struct msghdr *msg, | 597 | int kernel_sendmsg(struct socket *sock, struct msghdr *msg, |
581 | struct kvec *vec, size_t num, size_t size) | 598 | struct kvec *vec, size_t num, size_t size) |
582 | { | 599 | { |
@@ -1854,57 +1871,47 @@ SYSCALL_DEFINE2(shutdown, int, fd, int, how) | |||
1854 | #define COMPAT_NAMELEN(msg) COMPAT_MSG(msg, msg_namelen) | 1871 | #define COMPAT_NAMELEN(msg) COMPAT_MSG(msg, msg_namelen) |
1855 | #define COMPAT_FLAGS(msg) COMPAT_MSG(msg, msg_flags) | 1872 | #define COMPAT_FLAGS(msg) COMPAT_MSG(msg, msg_flags) |
1856 | 1873 | ||
1857 | /* | 1874 | static int __sys_sendmsg(struct socket *sock, struct msghdr __user *msg, |
1858 | * BSD sendmsg interface | 1875 | struct msghdr *msg_sys, unsigned flags, int nosec) |
1859 | */ | ||
1860 | |||
1861 | SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags) | ||
1862 | { | 1876 | { |
1863 | struct compat_msghdr __user *msg_compat = | 1877 | struct compat_msghdr __user *msg_compat = |
1864 | (struct compat_msghdr __user *)msg; | 1878 | (struct compat_msghdr __user *)msg; |
1865 | struct socket *sock; | ||
1866 | struct sockaddr_storage address; | 1879 | struct sockaddr_storage address; |
1867 | struct iovec iovstack[UIO_FASTIOV], *iov = iovstack; | 1880 | struct iovec iovstack[UIO_FASTIOV], *iov = iovstack; |
1868 | unsigned char ctl[sizeof(struct cmsghdr) + 20] | 1881 | unsigned char ctl[sizeof(struct cmsghdr) + 20] |
1869 | __attribute__ ((aligned(sizeof(__kernel_size_t)))); | 1882 | __attribute__ ((aligned(sizeof(__kernel_size_t)))); |
1870 | /* 20 is size of ipv6_pktinfo */ | 1883 | /* 20 is size of ipv6_pktinfo */ |
1871 | unsigned char *ctl_buf = ctl; | 1884 | unsigned char *ctl_buf = ctl; |
1872 | struct msghdr msg_sys; | ||
1873 | int err, ctl_len, iov_size, total_len; | 1885 | int err, ctl_len, iov_size, total_len; |
1874 | int fput_needed; | ||
1875 | 1886 | ||
1876 | err = -EFAULT; | 1887 | err = -EFAULT; |
1877 | if (MSG_CMSG_COMPAT & flags) { | 1888 | if (MSG_CMSG_COMPAT & flags) { |
1878 | if (get_compat_msghdr(&msg_sys, msg_compat)) | 1889 | if (get_compat_msghdr(msg_sys, msg_compat)) |
1879 | return -EFAULT; | 1890 | return -EFAULT; |
1880 | } else if (copy_from_user(&msg_sys, msg, sizeof(struct msghdr))) | 1891 | } else if (copy_from_user(msg_sys, msg, sizeof(struct msghdr))) |
1881 | return -EFAULT; | 1892 | return -EFAULT; |
1882 | 1893 | ||
1883 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | ||
1884 | if (!sock) | ||
1885 | goto out; | ||
1886 | |||
1887 | /* do not move before msg_sys is valid */ | 1894 | /* do not move before msg_sys is valid */ |
1888 | err = -EMSGSIZE; | 1895 | err = -EMSGSIZE; |
1889 | if (msg_sys.msg_iovlen > UIO_MAXIOV) | 1896 | if (msg_sys->msg_iovlen > UIO_MAXIOV) |
1890 | goto out_put; | 1897 | goto out; |
1891 | 1898 | ||
1892 | /* Check whether to allocate the iovec area */ | 1899 | /* Check whether to allocate the iovec area */ |
1893 | err = -ENOMEM; | 1900 | err = -ENOMEM; |
1894 | iov_size = msg_sys.msg_iovlen * sizeof(struct iovec); | 1901 | iov_size = msg_sys->msg_iovlen * sizeof(struct iovec); |
1895 | if (msg_sys.msg_iovlen > UIO_FASTIOV) { | 1902 | if (msg_sys->msg_iovlen > UIO_FASTIOV) { |
1896 | iov = sock_kmalloc(sock->sk, iov_size, GFP_KERNEL); | 1903 | iov = sock_kmalloc(sock->sk, iov_size, GFP_KERNEL); |
1897 | if (!iov) | 1904 | if (!iov) |
1898 | goto out_put; | 1905 | goto out; |
1899 | } | 1906 | } |
1900 | 1907 | ||
1901 | /* This will also move the address data into kernel space */ | 1908 | /* This will also move the address data into kernel space */ |
1902 | if (MSG_CMSG_COMPAT & flags) { | 1909 | if (MSG_CMSG_COMPAT & flags) { |
1903 | err = verify_compat_iovec(&msg_sys, iov, | 1910 | err = verify_compat_iovec(msg_sys, iov, |
1904 | (struct sockaddr *)&address, | 1911 | (struct sockaddr *)&address, |
1905 | VERIFY_READ); | 1912 | VERIFY_READ); |
1906 | } else | 1913 | } else |
1907 | err = verify_iovec(&msg_sys, iov, | 1914 | err = verify_iovec(msg_sys, iov, |
1908 | (struct sockaddr *)&address, | 1915 | (struct sockaddr *)&address, |
1909 | VERIFY_READ); | 1916 | VERIFY_READ); |
1910 | if (err < 0) | 1917 | if (err < 0) |
@@ -1913,17 +1920,17 @@ SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags) | |||
1913 | 1920 | ||
1914 | err = -ENOBUFS; | 1921 | err = -ENOBUFS; |
1915 | 1922 | ||
1916 | if (msg_sys.msg_controllen > INT_MAX) | 1923 | if (msg_sys->msg_controllen > INT_MAX) |
1917 | goto out_freeiov; | 1924 | goto out_freeiov; |
1918 | ctl_len = msg_sys.msg_controllen; | 1925 | ctl_len = msg_sys->msg_controllen; |
1919 | if ((MSG_CMSG_COMPAT & flags) && ctl_len) { | 1926 | if ((MSG_CMSG_COMPAT & flags) && ctl_len) { |
1920 | err = | 1927 | err = |
1921 | cmsghdr_from_user_compat_to_kern(&msg_sys, sock->sk, ctl, | 1928 | cmsghdr_from_user_compat_to_kern(msg_sys, sock->sk, ctl, |
1922 | sizeof(ctl)); | 1929 | sizeof(ctl)); |
1923 | if (err) | 1930 | if (err) |
1924 | goto out_freeiov; | 1931 | goto out_freeiov; |
1925 | ctl_buf = msg_sys.msg_control; | 1932 | ctl_buf = msg_sys->msg_control; |
1926 | ctl_len = msg_sys.msg_controllen; | 1933 | ctl_len = msg_sys->msg_controllen; |
1927 | } else if (ctl_len) { | 1934 | } else if (ctl_len) { |
1928 | if (ctl_len > sizeof(ctl)) { | 1935 | if (ctl_len > sizeof(ctl)) { |
1929 | ctl_buf = sock_kmalloc(sock->sk, ctl_len, GFP_KERNEL); | 1936 | ctl_buf = sock_kmalloc(sock->sk, ctl_len, GFP_KERNEL); |
@@ -1932,21 +1939,22 @@ SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags) | |||
1932 | } | 1939 | } |
1933 | err = -EFAULT; | 1940 | err = -EFAULT; |
1934 | /* | 1941 | /* |
1935 | * Careful! Before this, msg_sys.msg_control contains a user pointer. | 1942 | * Careful! Before this, msg_sys->msg_control contains a user pointer. |
1936 | * Afterwards, it will be a kernel pointer. Thus the compiler-assisted | 1943 | * Afterwards, it will be a kernel pointer. Thus the compiler-assisted |
1937 | * checking falls down on this. | 1944 | * checking falls down on this. |
1938 | */ | 1945 | */ |
1939 | if (copy_from_user(ctl_buf, | 1946 | if (copy_from_user(ctl_buf, |
1940 | (void __user __force *)msg_sys.msg_control, | 1947 | (void __user __force *)msg_sys->msg_control, |
1941 | ctl_len)) | 1948 | ctl_len)) |
1942 | goto out_freectl; | 1949 | goto out_freectl; |
1943 | msg_sys.msg_control = ctl_buf; | 1950 | msg_sys->msg_control = ctl_buf; |
1944 | } | 1951 | } |
1945 | msg_sys.msg_flags = flags; | 1952 | msg_sys->msg_flags = flags; |
1946 | 1953 | ||
1947 | if (sock->file->f_flags & O_NONBLOCK) | 1954 | if (sock->file->f_flags & O_NONBLOCK) |
1948 | msg_sys.msg_flags |= MSG_DONTWAIT; | 1955 | msg_sys->msg_flags |= MSG_DONTWAIT; |
1949 | err = sock_sendmsg(sock, &msg_sys, total_len); | 1956 | err = (nosec ? sock_sendmsg_nosec : sock_sendmsg)(sock, msg_sys, |
1957 | total_len); | ||
1950 | 1958 | ||
1951 | out_freectl: | 1959 | out_freectl: |
1952 | if (ctl_buf != ctl) | 1960 | if (ctl_buf != ctl) |
@@ -1954,12 +1962,114 @@ out_freectl: | |||
1954 | out_freeiov: | 1962 | out_freeiov: |
1955 | if (iov != iovstack) | 1963 | if (iov != iovstack) |
1956 | sock_kfree_s(sock->sk, iov, iov_size); | 1964 | sock_kfree_s(sock->sk, iov, iov_size); |
1957 | out_put: | 1965 | out: |
1966 | return err; | ||
1967 | } | ||
1968 | |||
1969 | /* | ||
1970 | * BSD sendmsg interface | ||
1971 | */ | ||
1972 | |||
1973 | SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned, flags) | ||
1974 | { | ||
1975 | int fput_needed, err; | ||
1976 | struct msghdr msg_sys; | ||
1977 | struct socket *sock = sockfd_lookup_light(fd, &err, &fput_needed); | ||
1978 | |||
1979 | if (!sock) | ||
1980 | goto out; | ||
1981 | |||
1982 | err = __sys_sendmsg(sock, msg, &msg_sys, flags, 0); | ||
1983 | |||
1958 | fput_light(sock->file, fput_needed); | 1984 | fput_light(sock->file, fput_needed); |
1959 | out: | 1985 | out: |
1960 | return err; | 1986 | return err; |
1961 | } | 1987 | } |
1962 | 1988 | ||
1989 | /* | ||
1990 | * Linux sendmmsg interface | ||
1991 | */ | ||
1992 | |||
1993 | int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, | ||
1994 | unsigned int flags) | ||
1995 | { | ||
1996 | int fput_needed, err, datagrams; | ||
1997 | struct socket *sock; | ||
1998 | struct mmsghdr __user *entry; | ||
1999 | struct compat_mmsghdr __user *compat_entry; | ||
2000 | struct msghdr msg_sys; | ||
2001 | |||
2002 | datagrams = 0; | ||
2003 | |||
2004 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | ||
2005 | if (!sock) | ||
2006 | return err; | ||
2007 | |||
2008 | err = sock_error(sock->sk); | ||
2009 | if (err) | ||
2010 | goto out_put; | ||
2011 | |||
2012 | entry = mmsg; | ||
2013 | compat_entry = (struct compat_mmsghdr __user *)mmsg; | ||
2014 | |||
2015 | while (datagrams < vlen) { | ||
2016 | /* | ||
2017 | * No need to ask LSM for more than the first datagram. | ||
2018 | */ | ||
2019 | if (MSG_CMSG_COMPAT & flags) { | ||
2020 | err = __sys_sendmsg(sock, (struct msghdr __user *)compat_entry, | ||
2021 | &msg_sys, flags, datagrams); | ||
2022 | if (err < 0) | ||
2023 | break; | ||
2024 | err = __put_user(err, &compat_entry->msg_len); | ||
2025 | ++compat_entry; | ||
2026 | } else { | ||
2027 | err = __sys_sendmsg(sock, (struct msghdr __user *)entry, | ||
2028 | &msg_sys, flags, datagrams); | ||
2029 | if (err < 0) | ||
2030 | break; | ||
2031 | err = put_user(err, &entry->msg_len); | ||
2032 | ++entry; | ||
2033 | } | ||
2034 | |||
2035 | if (err) | ||
2036 | break; | ||
2037 | ++datagrams; | ||
2038 | } | ||
2039 | |||
2040 | out_put: | ||
2041 | fput_light(sock->file, fput_needed); | ||
2042 | |||
2043 | if (err == 0) | ||
2044 | return datagrams; | ||
2045 | |||
2046 | if (datagrams != 0) { | ||
2047 | /* | ||
2048 | * We may send less entries than requested (vlen) if the | ||
2049 | * sock is non blocking... | ||
2050 | */ | ||
2051 | if (err != -EAGAIN) { | ||
2052 | /* | ||
2053 | * ... or if sendmsg returns an error after we | ||
2054 | * send some datagrams, where we record the | ||
2055 | * error to return on the next call or if the | ||
2056 | * app asks about it using getsockopt(SO_ERROR). | ||
2057 | */ | ||
2058 | sock->sk->sk_err = -err; | ||
2059 | } | ||
2060 | |||
2061 | return datagrams; | ||
2062 | } | ||
2063 | |||
2064 | return err; | ||
2065 | } | ||
2066 | |||
2067 | SYSCALL_DEFINE4(sendmmsg, int, fd, struct mmsghdr __user *, mmsg, | ||
2068 | unsigned int, vlen, unsigned int, flags) | ||
2069 | { | ||
2070 | return __sys_sendmmsg(fd, mmsg, vlen, flags); | ||
2071 | } | ||
2072 | |||
1963 | static int __sys_recvmsg(struct socket *sock, struct msghdr __user *msg, | 2073 | static int __sys_recvmsg(struct socket *sock, struct msghdr __user *msg, |
1964 | struct msghdr *msg_sys, unsigned flags, int nosec) | 2074 | struct msghdr *msg_sys, unsigned flags, int nosec) |
1965 | { | 2075 | { |
@@ -2113,14 +2223,16 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, | |||
2113 | */ | 2223 | */ |
2114 | if (MSG_CMSG_COMPAT & flags) { | 2224 | if (MSG_CMSG_COMPAT & flags) { |
2115 | err = __sys_recvmsg(sock, (struct msghdr __user *)compat_entry, | 2225 | err = __sys_recvmsg(sock, (struct msghdr __user *)compat_entry, |
2116 | &msg_sys, flags, datagrams); | 2226 | &msg_sys, flags & ~MSG_WAITFORONE, |
2227 | datagrams); | ||
2117 | if (err < 0) | 2228 | if (err < 0) |
2118 | break; | 2229 | break; |
2119 | err = __put_user(err, &compat_entry->msg_len); | 2230 | err = __put_user(err, &compat_entry->msg_len); |
2120 | ++compat_entry; | 2231 | ++compat_entry; |
2121 | } else { | 2232 | } else { |
2122 | err = __sys_recvmsg(sock, (struct msghdr __user *)entry, | 2233 | err = __sys_recvmsg(sock, (struct msghdr __user *)entry, |
2123 | &msg_sys, flags, datagrams); | 2234 | &msg_sys, flags & ~MSG_WAITFORONE, |
2235 | datagrams); | ||
2124 | if (err < 0) | 2236 | if (err < 0) |
2125 | break; | 2237 | break; |
2126 | err = put_user(err, &entry->msg_len); | 2238 | err = put_user(err, &entry->msg_len); |
@@ -2205,11 +2317,11 @@ SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg, | |||
2205 | #ifdef __ARCH_WANT_SYS_SOCKETCALL | 2317 | #ifdef __ARCH_WANT_SYS_SOCKETCALL |
2206 | /* Argument list sizes for sys_socketcall */ | 2318 | /* Argument list sizes for sys_socketcall */ |
2207 | #define AL(x) ((x) * sizeof(unsigned long)) | 2319 | #define AL(x) ((x) * sizeof(unsigned long)) |
2208 | static const unsigned char nargs[20] = { | 2320 | static const unsigned char nargs[21] = { |
2209 | AL(0), AL(3), AL(3), AL(3), AL(2), AL(3), | 2321 | AL(0), AL(3), AL(3), AL(3), AL(2), AL(3), |
2210 | AL(3), AL(3), AL(4), AL(4), AL(4), AL(6), | 2322 | AL(3), AL(3), AL(4), AL(4), AL(4), AL(6), |
2211 | AL(6), AL(2), AL(5), AL(5), AL(3), AL(3), | 2323 | AL(6), AL(2), AL(5), AL(5), AL(3), AL(3), |
2212 | AL(4), AL(5) | 2324 | AL(4), AL(5), AL(4) |
2213 | }; | 2325 | }; |
2214 | 2326 | ||
2215 | #undef AL | 2327 | #undef AL |
@@ -2229,7 +2341,7 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) | |||
2229 | int err; | 2341 | int err; |
2230 | unsigned int len; | 2342 | unsigned int len; |
2231 | 2343 | ||
2232 | if (call < 1 || call > SYS_RECVMMSG) | 2344 | if (call < 1 || call > SYS_SENDMMSG) |
2233 | return -EINVAL; | 2345 | return -EINVAL; |
2234 | 2346 | ||
2235 | len = nargs[call]; | 2347 | len = nargs[call]; |
@@ -2304,6 +2416,9 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) | |||
2304 | case SYS_SENDMSG: | 2416 | case SYS_SENDMSG: |
2305 | err = sys_sendmsg(a0, (struct msghdr __user *)a1, a[2]); | 2417 | err = sys_sendmsg(a0, (struct msghdr __user *)a1, a[2]); |
2306 | break; | 2418 | break; |
2419 | case SYS_SENDMMSG: | ||
2420 | err = sys_sendmmsg(a0, (struct mmsghdr __user *)a1, a[2], a[3]); | ||
2421 | break; | ||
2307 | case SYS_RECVMSG: | 2422 | case SYS_RECVMSG: |
2308 | err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]); | 2423 | err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]); |
2309 | break; | 2424 | break; |
@@ -2634,13 +2749,13 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32) | |||
2634 | return -EFAULT; | 2749 | return -EFAULT; |
2635 | 2750 | ||
2636 | if (convert_in) { | 2751 | if (convert_in) { |
2637 | /* We expect there to be holes between fs.m_u and | 2752 | /* We expect there to be holes between fs.m_ext and |
2638 | * fs.ring_cookie and at the end of fs, but nowhere else. | 2753 | * fs.ring_cookie and at the end of fs, but nowhere else. |
2639 | */ | 2754 | */ |
2640 | BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_u) + | 2755 | BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_ext) + |
2641 | sizeof(compat_rxnfc->fs.m_u) != | 2756 | sizeof(compat_rxnfc->fs.m_ext) != |
2642 | offsetof(struct ethtool_rxnfc, fs.m_u) + | 2757 | offsetof(struct ethtool_rxnfc, fs.m_ext) + |
2643 | sizeof(rxnfc->fs.m_u)); | 2758 | sizeof(rxnfc->fs.m_ext)); |
2644 | BUILD_BUG_ON( | 2759 | BUILD_BUG_ON( |
2645 | offsetof(struct compat_ethtool_rxnfc, fs.location) - | 2760 | offsetof(struct compat_ethtool_rxnfc, fs.location) - |
2646 | offsetof(struct compat_ethtool_rxnfc, fs.ring_cookie) != | 2761 | offsetof(struct compat_ethtool_rxnfc, fs.ring_cookie) != |
@@ -2648,7 +2763,7 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32) | |||
2648 | offsetof(struct ethtool_rxnfc, fs.ring_cookie)); | 2763 | offsetof(struct ethtool_rxnfc, fs.ring_cookie)); |
2649 | 2764 | ||
2650 | if (copy_in_user(rxnfc, compat_rxnfc, | 2765 | if (copy_in_user(rxnfc, compat_rxnfc, |
2651 | (void *)(&rxnfc->fs.m_u + 1) - | 2766 | (void *)(&rxnfc->fs.m_ext + 1) - |
2652 | (void *)rxnfc) || | 2767 | (void *)rxnfc) || |
2653 | copy_in_user(&rxnfc->fs.ring_cookie, | 2768 | copy_in_user(&rxnfc->fs.ring_cookie, |
2654 | &compat_rxnfc->fs.ring_cookie, | 2769 | &compat_rxnfc->fs.ring_cookie, |
@@ -2665,7 +2780,7 @@ static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32) | |||
2665 | 2780 | ||
2666 | if (convert_out) { | 2781 | if (convert_out) { |
2667 | if (copy_in_user(compat_rxnfc, rxnfc, | 2782 | if (copy_in_user(compat_rxnfc, rxnfc, |
2668 | (const void *)(&rxnfc->fs.m_u + 1) - | 2783 | (const void *)(&rxnfc->fs.m_ext + 1) - |
2669 | (const void *)rxnfc) || | 2784 | (const void *)rxnfc) || |
2670 | copy_in_user(&compat_rxnfc->fs.ring_cookie, | 2785 | copy_in_user(&compat_rxnfc->fs.ring_cookie, |
2671 | &rxnfc->fs.ring_cookie, | 2786 | &rxnfc->fs.ring_cookie, |