From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Eric Dumazet <edumazet@google.com>, Willem de Bruijn <willemb@google.com>, "David S. Miller" <davem@davemloft.net> Subject: [PATCH 3.14 12/44] udp: fix behavior of wrong checksums Date: Fri, 19 Jun 2015 13:36:11 -0700 [thread overview] Message-ID: <20150619203556.574830758@linuxfoundation.org> (raw) In-Reply-To: <20150619203556.192033912@linuxfoundation.org> 3.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet <edumazet@google.com> [ Upstream commit beb39db59d14990e401e235faf66a6b9b31240b0 ] We have two problems in UDP stack related to bogus checksums : 1) We return -EAGAIN to application even if receive queue is not empty. This breaks applications using edge trigger epoll() 2) Under UDP flood, we can loop forever without yielding to other processes, potentially hanging the host, especially on non SMP. This patch is an attempt to make things better. We might in the future add extra support for rt applications wanting to better control time spent doing a recv() in a hostile environment. For example we could validate checksums before queuing packets in socket receive queue. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- net/ipv4/udp.c | 6 ++---- net/ipv6/udp.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1317,10 +1317,8 @@ csum_copy_err: } unlock_sock_fast(sk, slow); - if (noblock) - return -EAGAIN; - - /* starting over for a new packet */ + /* starting over for a new packet, but check if we need to yield */ + cond_resched(); msg->msg_flags &= ~MSG_TRUNC; goto try_again; } --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -515,10 +515,8 @@ csum_copy_err: } unlock_sock_fast(sk, slow); - if (noblock) - return -EAGAIN; - - /* starting over for a new packet */ + /* starting over for a new packet, but check if we need to yield */ + cond_resched(); msg->msg_flags &= ~MSG_TRUNC; goto try_again; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Eric Dumazet <edumazet@google.com>, Willem de Bruijn <willemb@google.com>, "David S. Miller" <davem@davemloft.net> Subject: [PATCH 3.14 12/44] udp: fix behavior of wrong checksums Date: Fri, 19 Jun 2015 13:36:11 -0700 [thread overview] Message-ID: <20150619203556.574830758@linuxfoundation.org> (raw) In-Reply-To: <20150619203556.192033912@linuxfoundation.org> 3.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Dumazet <edumazet@google.com> [ Upstream commit beb39db59d14990e401e235faf66a6b9b31240b0 ] We have two problems in UDP stack related to bogus checksums : 1) We return -EAGAIN to application even if receive queue is not empty. This breaks applications using edge trigger epoll() 2) Under UDP flood, we can loop forever without yielding to other processes, potentially hanging the host, especially on non SMP. This patch is an attempt to make things better. We might in the future add extra support for rt applications wanting to better control time spent doing a recv() in a hostile environment. For example we could validate checksums before queuing packets in socket receive queue. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- net/ipv4/udp.c | 6 ++---- net/ipv6/udp.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1317,10 +1317,8 @@ csum_copy_err: } unlock_sock_fast(sk, slow); - if (noblock) - return -EAGAIN; - - /* starting over for a new packet */ + /* starting over for a new packet, but check if we need to yield */ + cond_resched(); msg->msg_flags &= ~MSG_TRUNC; goto try_again; } --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -515,10 +515,8 @@ csum_copy_err: } unlock_sock_fast(sk, slow); - if (noblock) - return -EAGAIN; - - /* starting over for a new packet */ + /* starting over for a new packet, but check if we need to yield */ + cond_resched(); msg->msg_flags &= ~MSG_TRUNC; goto try_again; } -- To unsubscribe from this list: send the line "unsubscribe stable" in
next prev parent reply other threads:[~2015-06-19 21:08 UTC|newest] Thread overview: 86+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-06-19 20:35 [PATCH 3.14 00/44] 3.14.45-stable review Greg Kroah-Hartman 2015-06-19 20:35 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 01/44] crush: ensuring at most num-rep osds are selected Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 02/44] net: core: Correct an over-stringent device loop detection Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 03/44] x86: bpf_jit: fix compilation of large bpf programs Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 04/44] net: phy: Allow EEE for all RGMII variants Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 05/44] tcp/ipv6: fix flow label setting in TIME_WAIT state Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 06/44] ipv4: Avoid crashing in ip_error Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 07/44] bridge: fix parsing of MLDv2 reports Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 08/44] net: dp83640: fix broken calibration routine Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 09/44] net: dp83640: reinforce locking rules Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 10/44] unix/caif: sk_socket can disappear when state is unlocked Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 11/44] net_sched: invoke ->attach() after setting dev->qdisc Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman [this message] 2015-06-19 20:36 ` [PATCH 3.14 12/44] udp: fix behavior of wrong checksums Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 13/44] xen: netback: read hotplug script once at start of day Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 14/44] ipv4/udp: Verify multicast group is ours in upd_v4_early_demux() Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 15/44] bridge: disable softirqs around br_fdb_update to avoid lockup Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 16/44] iio: adc: twl6030-gpadc: Fix modalias Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 17/44] iio: adis16400: Report pressure channel scale Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 18/44] iio: adis16400: Use != channel indices for the two voltage channels Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 19/44] iio: adis16400: Compute the scan mask from channel indices Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 21/44] ALSA: hda/realtek - Add a fixup for another Acer Aspire 9420 Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 22/44] ALSA: usb-audio: Add mic volume fix quirk for Logitech Quickcam Fusion Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 23/44] ALSA: usb-audio: add MAYA44 USB+ mixer control names Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 24/44] Input: synaptics - add min/max quirk for Lenovo S540 Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 26/44] block: fix ext_dev_lock lockdep report Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 27/44] USB: cp210x: add ID for HubZ dual ZigBee and Z-Wave dongle Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 28/44] USB: serial: ftdi_sio: Add support for a Motion Tracker Development Board Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 29/44] x86/asm/irq: Stop relying on magic JMP behavior for early_idt_handlers Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 30/44] ring-buffer-benchmark: Fix the wrong sched_priority of producer Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 31/44] MIPS: Fix enabling of DEBUG_STACKOVERFLOW Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 32/44] ozwpan: Use proper check to prevent heap overflow Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 33/44] ozwpan: divide-by-zero leading to panic Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 34/44] ozwpan: unchecked signed subtraction leads to DoS Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 35/44] pata_octeon_cf: fix broken build Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 36/44] ARM: dts: am335x-boneblack: disable RTC-only sleep to avoid hardware damage Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-22 8:23 ` Johan Hovold 2015-06-22 8:23 ` Johan Hovold 2015-06-22 15:41 ` Greg Kroah-Hartman 2015-06-22 15:41 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 37/44] drm/i915/hsw: Fix workaround for server AUX channel clock divisor Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 40/44] serial: imx: Fix DMA handling for IDLE condition aborts Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 41/44] mm/memory_hotplug.c: set zone->wait_table to null after freeing it Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 42/44] cfg80211: wext: clear sinfo struct before calling driver Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 43/44] btrfs: incorrect handling for fiemap_fill_next_extent return Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-19 20:36 ` [PATCH 3.14 44/44] btrfs: cleanup orphans while looking up default subvolume Greg Kroah-Hartman 2015-06-19 20:36 ` Greg Kroah-Hartman 2015-06-20 1:12 ` [PATCH 3.14 00/44] 3.14.45-stable review Shuah Khan 2015-06-20 1:12 ` Shuah Khan 2015-06-20 1:26 ` Guenter Roeck 2015-06-20 1:26 ` Guenter Roeck 2015-06-20 7:49 ` Sudip Mukherjee 2015-06-20 7:49 ` Sudip Mukherjee
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20150619203556.574830758@linuxfoundation.org \ --to=gregkh@linuxfoundation.org \ --cc=davem@davemloft.net \ --cc=edumazet@google.com \ --cc=linux-kernel@vger.kernel.org \ --cc=stable@vger.kernel.org \ --cc=willemb@google.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.