From: David Ahern <dsahern@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
David Miller <davem@davemloft.net>,
dsahern@kernel.org
Cc: netdev@vger.kernel.org, weiwan@google.com, sd@queasysnail.net,
xiyou.wangcong@gmail.com
Subject: Re: [PATCH net-next 0/5] net: Consolidate metrics handling for ipv4 and ipv6
Date: Fri, 5 Oct 2018 09:37:23 -0600 [thread overview]
Message-ID: <19a1e616-4597-cc01-1f13-e50c7366f304@gmail.com> (raw)
In-Reply-To: <d6cd6b12-9e7c-b84b-7dfb-20e47b77b8f6@gmail.com>
On 10/5/18 7:08 AM, Eric Dumazet wrote:
> Commit 767a2217533fed6 ("net: common metrics init helper for FIB entries")
> is not correct because we need to better deal with error paths.
>
> I will submit this more formally when I can reach my workstation in a few minutes :
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 6c1d817151cae45421dc976c5ea082b4115650be..74d97addf1af20dda0c2b6a2018e88696f9f7d5a 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -2976,6 +2976,8 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
> rt->fib6_metrics = ip_fib_metrics_init(net, cfg->fc_mx, cfg->fc_mx_len);
> if (IS_ERR(rt->fib6_metrics)) {
> err = PTR_ERR(rt->fib6_metrics);
> + /* Do not leave garbage there. */
> + rt->fib6_metrics = (struct dst_metrics *)&dst_default_metrics;
> goto out;
> }
>
>
Yes, I was focused on the memory leaks and cleanup and forgot to
purposely fail the alloc for the metrics. The above is one way to fix
it. Thanks for spotting it.
next prev parent reply other threads:[~2018-10-05 22:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20181005030755.31217-1-dsahern@kernel.org>
2018-10-05 4:55 ` [PATCH net-next 0/5] net: Consolidate metrics handling for ipv4 and ipv6 David Miller
2018-10-05 12:17 ` Eric Dumazet
2018-10-05 13:08 ` Eric Dumazet
2018-10-05 15:37 ` David Ahern [this message]
2018-10-05 17:50 ` David Miller
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=19a1e616-4597-cc01-1f13-e50c7366f304@gmail.com \
--to=dsahern@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=sd@queasysnail.net \
--cc=weiwan@google.com \
--cc=xiyou.wangcong@gmail.com \
/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).