]> git.baikalelectronics.ru Git - kernel.git/commit
net: drop dst before queueing fragments
authorEric Dumazet <edumazet@google.com>
Tue, 16 Apr 2013 12:55:41 +0000 (12:55 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 Apr 2013 05:15:29 +0000 (01:15 -0400)
commitb7c29962d55c1682782ce9d89d0de841ff21e8e1
tree77fdf7ed0dfe7b8a9f0fe10663603892e12e8687
parentb5b377755ca9be239a264bcea6377c5267e0152f
net: drop dst before queueing fragments

Commit 58c73bb72aff (net: Use ip_route_input_noref() in input path)
added a bug in IP defragmentation handling, as non refcounted
dst could escape an RCU protected section.

Commit a168f6b32edecb8 (net: ip_expire() must revalidate route) fixed
the case of timeouts, but not the general problem.

Tom Parkin noticed crashes in UDP stack and provided a patch,
but further analysis permitted us to pinpoint the root cause.

Before queueing a packet into a frag list, we must drop its dst,
as this dst has limited lifetime (RCU protected)

When/if a packet is finally reassembled, we use the dst of the very
last skb, still protected by RCU and valid, as the dst of the
reassembled packet.

Use same logic in IPv6, as there is no need to hold dst references.

Reported-by: Tom Parkin <tparkin@katalix.com>
Tested-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_fragment.c
net/ipv6/reassembly.c