From: David Miller <davem@davemloft.net>
To: sd@queasysnail.net
Cc: netdev@vger.kernel.org, brakmo@fb.com, daniel@iogearbox.net
Subject: Re: [PATCH net] tcp: fix refcnt leak with ebpf congestion control
Date: Fri, 25 Aug 2017 17:16:57 -0700 (PDT) [thread overview]
Message-ID: <20170825.171657.1442719401892146442.davem@davemloft.net> (raw)
In-Reply-To: <d69d1981d2c74805affc4ed6378447ea4cb06c67.1503659184.git.sd@queasysnail.net>
From: Sabrina Dubroca <sd@queasysnail.net>
Date: Fri, 25 Aug 2017 13:10:12 +0200
> There are a few bugs around refcnt handling in the new BPF congestion
> control setsockopt:
>
> - The new ca is assigned to icsk->icsk_ca_ops even in the case where we
> cannot get a reference on it. This would lead to a use after free,
> since that ca is going away soon.
>
> - Changing the congestion control case doesn't release the refcnt on
> the previous ca.
>
> - In the reinit case, we first leak a reference on the old ca, then we
> call tcp_reinit_congestion_control on the ca that we have just
> assigned, leading to deinitializing the wrong ca (->release of the
> new ca on the old ca's data) and releasing the refcount on the ca
> that we actually want to use.
>
> This is visible by building (for example) BIC as a module and setting
> net.ipv4.tcp_congestion_control=bic, and using tcp_cong_kern.c from
> samples/bpf.
>
> This patch fixes the refcount issues, and moves reinit back into tcp
> core to avoid passing a ca pointer back to BPF.
>
> Fixes: 91b5b21c7c16 ("bpf: Add support for changing congestion control")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Applied, thank you.
prev parent reply other threads:[~2017-08-26 0:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-25 11:10 [PATCH net] tcp: fix refcnt leak with ebpf congestion control Sabrina Dubroca
2017-08-25 23:08 ` Lawrence Brakmo
2017-08-26 0:16 ` David Miller [this message]
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=20170825.171657.1442719401892146442.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=brakmo@fb.com \
--cc=daniel@iogearbox.net \
--cc=netdev@vger.kernel.org \
--cc=sd@queasysnail.net \
/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).