From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
"Steinar H. Gunderson" <sgunderson@bigfoot.com>,
Valentijn Sessink <valentyn@blub.net>,
YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>,
Hannes Frederic Sowa <hannes@stressinduktion.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 3.12 11/19] ipv6: ip6_dst_check needs to check for expired dst_entries
Date: Mon, 18 Nov 2013 10:37:24 -0800 [thread overview]
Message-ID: <20131118183647.402237441@linuxfoundation.org> (raw)
In-Reply-To: <20131118183644.030738675@linuxfoundation.org>
3.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
[ Upstream commit e3bc10bd95d7fcc3f2ac690c6ff22833ea6781d6 ]
On receiving a packet too big icmp error we check if our current cached
dst_entry in the socket is still valid. This validation check did not
care about the expiration of the (cached) route.
The error path I traced down:
The socket receives a packet too big mtu notification. It still has a
valid dst_entry and thus issues the ip6_rt_pmtu_update on this dst_entry,
setting RTF_EXPIRE and updates the dst.expiration value (which could
fail because of not up-to-date expiration values, see previous patch).
In some seldom cases we race with a) the ip6_fib gc or b) another routing
lookup which would result in a recreation of the cached rt6_info from its
parent non-cached rt6_info. While copying the rt6_info we reinitialize the
metrics store by copying it over from the parent thus invalidating the
just installed pmtu update (both dsts use the same key to the inetpeer
storage). The dst_entry with the just invalidated metrics data would
just get its RTF_EXPIRES flag cleared and would continue to stay valid
for the socket.
We should have not issued the pmtu update on the already expired dst_entry
in the first placed. By checking the expiration on the dst entry and
doing a relookup in case it is out of date we close the race because
we would install a new rt6_info into the fib before we issue the pmtu
update, thus closing this race.
Not reliably updating the dst.expire value was fixed by the patch "ipv6:
reset dst.expires value when clearing expire flag".
Reported-by: Steinar H. Gunderson <sgunderson@bigfoot.com>
Reported-by: Valentijn Sessink <valentyn@blub.net>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Tested-by: Valentijn Sessink <valentyn@blub.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/route.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1087,10 +1087,13 @@ static struct dst_entry *ip6_dst_check(s
if (rt->rt6i_genid != rt_genid_ipv6(dev_net(rt->dst.dev)))
return NULL;
- if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie))
- return dst;
+ if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie))
+ return NULL;
+
+ if (rt6_check_expired(rt))
+ return NULL;
- return NULL;
+ return dst;
}
static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
next prev parent reply other threads:[~2013-11-18 18:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 18:37 [PATCH 3.12 00/19] 3.12.1-stable review Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 01/19] net/mlx4_core: Fix call to __mlx4_unregister_mac Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 02/19] net: sctp: do not trigger BUG_ON in sctp_cmd_delete_tcb Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 03/19] net: flow_dissector: fail on evil iph->ihl Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 04/19] virtio-net: correctly handle cpu hotplug notifier during resuming Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 05/19] xen-netback: use jiffies_64 value to calculate credit timeout Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 06/19] cxgb3: Fix length calculation in write_ofld_wr() on 32-bit architectures Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 07/19] tcp: gso: fix truesize tracking Greg Kroah-Hartman
2013-11-28 5:25 ` Ben Hutchings
2013-12-05 21:31 ` David Miller
2013-11-18 18:37 ` [PATCH 3.12 08/19] tcp: fix SYNACK RTT estimation in Fast Open Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 09/19] tcp: only take RTT from timestamps if new data is acked Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 10/19] tcp: do not rearm RTO when future data are sacked Greg Kroah-Hartman
2013-11-18 18:37 ` Greg Kroah-Hartman [this message]
2013-11-18 18:37 ` [PATCH 3.12 12/19] ipv6: reset dst.expires value when clearing expire flag Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 13/19] hyperv-fb: add pci stub Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 14/19] USB: add new zte 3g-dongles pid to option.c Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 15/19] ALSA: hda - hdmi: Fix reported channel map on common default layouts Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 16/19] tracing: Fix potential out-of-bounds in trace_get_user() Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 17/19] misc: atmel_pwm: add deferred-probing support Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 18/19] backlight: atmel-pwm-bl: fix deferred probe from __init Greg Kroah-Hartman
2013-11-18 18:37 ` [PATCH 3.12 19/19] usbcore: set lpm_capable field for LPM capable root hubs Greg Kroah-Hartman
2013-11-19 3:11 ` [PATCH 3.12 00/19] 3.12.1-stable review Guenter Roeck
2013-11-20 11:07 ` Satoru Takeuchi
2013-11-20 15:25 ` Shuah Khan
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=20131118183647.402237441@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hannes@stressinduktion.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sgunderson@bigfoot.com \
--cc=stable@vger.kernel.org \
--cc=valentyn@blub.net \
--cc=yoshfuji@linux-ipv6.org \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).