kernel-ark/net/ipv6
Xufeng Zhang 32c90254ed ipv6/udp: Use the correct variable to determine non-blocking condition
udpv6_recvmsg() function is not using the correct variable to determine
whether or not the socket is in non-blocking operation, this will lead
to unexpected behavior when a UDP checksum error occurs.

Consider a non-blocking udp receive scenario: when udpv6_recvmsg() is
called by sock_common_recvmsg(), MSG_DONTWAIT bit of flags variable in
udpv6_recvmsg() is cleared by "flags & ~MSG_DONTWAIT" in this call:

    err = sk->sk_prot->recvmsg(iocb, sk, msg, size, flags & MSG_DONTWAIT,
                   flags & ~MSG_DONTWAIT, &addr_len);

i.e. with udpv6_recvmsg() getting these values:

	int noblock = flags & MSG_DONTWAIT
	int flags = flags & ~MSG_DONTWAIT

So, when udp checksum error occurs, the execution will go to
csum_copy_err, and then the problem happens:

    csum_copy_err:
            ...............
            if (flags & MSG_DONTWAIT)
                    return -EAGAIN;
            goto try_again;
            ...............

But it will always go to try_again as MSG_DONTWAIT has been cleared
from flags at call time -- only noblock contains the original value
of MSG_DONTWAIT, so the test should be:

            if (noblock)
                    return -EAGAIN;

This is also consistent with what the ipv4/udp code does.

Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2011-06-21 22:34:27 -07:00
..
netfilter netfilter: fix looped (broad|multi)cast's MAC handling 2011-06-16 17:27:04 +02:00
addrconf_core.c
addrconf.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2011-05-20 13:43:21 -07:00
addrlabel.c
af_inet6.c net/ipv6: check for mistakenly passed in non-AF_INET6 sockaddrs 2011-06-06 14:48:16 -07:00
ah6.c xfrm: Use separate low and high order bits of the sequence numbers in xfrm_skb_cb 2011-03-13 20:22:28 -07:00
anycast.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
datagram.c net: Put fl6_* macros to struct flowi6 and use them again. 2011-03-12 15:08:55 -08:00
esp6.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2011-05-05 14:59:02 -07:00
exthdrs_core.c
exthdrs.c ipv6: Convert to use flowi6 where applicable. 2011-03-12 15:08:54 -08:00
fib6_rules.c ipv6: Convert to use flowi6 where applicable. 2011-03-12 15:08:54 -08:00
icmp.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
inet6_connection_sock.c inet: Pass flowi to ->queue_xmit(). 2011-05-08 15:28:28 -07:00
inet6_hashtables.c Kill off warning: ‘inline’ is not at beginning of declaration 2011-01-19 15:43:08 +01:00
ip6_fib.c net: dont hold rtnl mutex during netlink dump callbacks 2011-05-02 15:26:28 -07:00
ip6_flowlabel.c ipv6: Convert to use flowi6 where applicable. 2011-03-12 15:08:54 -08:00
ip6_input.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
ip6_output.c inet: Decrease overhead of on-stack inet_cork. 2011-05-06 15:37:57 -07:00
ip6_tunnel.c net: call dev_alloc_name from register_netdevice 2011-05-05 10:57:45 -07:00
ip6mr.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
ipcomp6.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
ipv6_sockglue.c ipv6: Convert to use flowi6 where applicable. 2011-03-12 15:08:54 -08:00
Kconfig
Makefile
mcast.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2011-05-20 13:43:21 -07:00
mip6.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
ndisc.c ipv4, ipv6, bonding: Restore control over number of peer notifications 2011-04-29 12:44:11 -07:00
netfilter.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
proc.c ipv6: reduce per device ICMP mib sizes 2011-05-19 16:21:22 -04:00
protocol.c
raw.c net: convert %p usage to %pK 2011-05-24 01:13:12 -04:00
reassembly.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
route.c ipv6: copy prefsrc setting when copying route entry 2011-05-21 02:05:22 -04:00
sit.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2011-05-20 13:43:21 -07:00
syncookies.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
sysctl_net_ipv6.c net ipv6: Fix duplicate /proc/sys/net/ipv6/neigh directory entries. 2011-03-21 18:23:34 -07:00
tcp_ipv6.c net: rfs: enable RFS before first data packet is received 2011-06-17 15:27:31 -04:00
tunnel6.c
udp_impl.h
udp.c ipv6/udp: Use the correct variable to determine non-blocking condition 2011-06-21 22:34:27 -07:00
udplite.c
xfrm6_input.c
xfrm6_mode_beet.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
xfrm6_mode_ro.c
xfrm6_mode_transport.c
xfrm6_mode_tunnel.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
xfrm6_output.c xfrm: Assign the inner mode output function to the dst entry 2011-05-10 15:03:34 -07:00
xfrm6_policy.c inet: constify ip headers and in6_addr 2011-04-22 11:04:14 -07:00
xfrm6_state.c xfrm: Assign the inner mode output function to the dst entry 2011-05-10 15:03:34 -07:00
xfrm6_tunnel.c ipv6: Fix return of xfrm6_tunnel_rcv() 2011-05-24 01:11:51 -04:00