diff options
author | Paolo Abeni <pabeni@redhat.com> | 2017-07-27 14:45:09 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-29 14:19:03 -0700 |
commit | c9f2c1ae123a751d4e4f949144500219354d5ee1 (patch) | |
tree | e6aad6e2b11c6d81215532315d86d4d22fb59838 /kernel | |
parent | 500268e9f28de972514de89a5a1b4106d0417989 (diff) | |
download | linux-c9f2c1ae123a751d4e4f949144500219354d5ee1.tar.bz2 |
udp6: fix socket leak on early demux
When an early demuxed packet reaches __udp6_lib_lookup_skb(), the
sk reference is retrieved and used, but the relevant reference
count is leaked and the socket destructor is never called.
Beyond leaking the sk memory, if there are pending UDP packets
in the receive queue, even the related accounted memory is leaked.
In the long run, this will cause persistent forward allocation errors
and no UDP skbs (both ipv4 and ipv6) will be able to reach the
user-space.
Fix this by explicitly accessing the early demux reference before
the lookup, and properly decreasing the socket reference count
after usage.
Also drop the skb_steal_sock() in __udp6_lib_lookup_skb(), and
the now obsoleted comment about "socket cache".
The newly added code is derived from the current ipv4 code for the
similar path.
v1 -> v2:
fixed the __udp6_lib_rcv() return code for resubmission,
as suggested by Eric
Reported-by: Sam Edwards <CFSworks@gmail.com>
Reported-by: Marc Haber <mh+netdev@zugschlus.de>
Fixes: 5425077d73e0 ("net: ipv6: Add early demux handler for UDP unicast")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions