From: David Miller <davem@davemloft.net>
To: pabeni@redhat.com
Cc: netdev@vger.kernel.org, edumazet@google.com, CFSworks@gmail.com,
mh+netdev@zugschlus.de, subashab@codeaurora.org
Subject: Re: [PATCH net] udp6: fix socket leak on early demux
Date: Sat, 29 Jul 2017 14:19:43 -0700 (PDT) [thread overview]
Message-ID: <20170729.141943.1705828011017202803.davem@davemloft.net> (raw)
In-Reply-To: <714e32ad7eb21b0b791ecc314cfcc16765c96cd9.1501159497.git.pabeni@redhat.com>
From: Paolo Abeni <pabeni@redhat.com>
Date: Thu, 27 Jul 2017 14:45:09 +0200
> 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>
Applied.
next prev parent reply other threads:[~2017-07-29 21:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-27 12:45 [PATCH net] udp6: fix socket leak on early demux Paolo Abeni
2017-07-27 12:56 ` Paolo Abeni
2017-07-27 13:35 ` Eric Dumazet
2017-07-29 21:19 ` David Miller [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-07-26 15:29 Paolo Abeni
2017-07-27 7:06 ` Eric Dumazet
2017-07-27 9:31 ` Paolo Abeni
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=20170729.141943.1705828011017202803.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=CFSworks@gmail.com \
--cc=edumazet@google.com \
--cc=mh+netdev@zugschlus.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=subashab@codeaurora.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).