From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH net] ipv6: do not leave garbage in rt->fib6_metrics Date: Fri, 5 Oct 2018 10:29:36 -0600 Message-ID: <5c82ffec-bb35-9bc9-38f4-95962691641a@gmail.com> References: <20181005161750.179275-1-edumazet@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev , Eric Dumazet To: Eric Dumazet , "David S . Miller" Return-path: Received: from mail-pl1-f195.google.com ([209.85.214.195]:33409 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727941AbeJEX3G (ORCPT ); Fri, 5 Oct 2018 19:29:06 -0400 Received: by mail-pl1-f195.google.com with SMTP id s4-v6so7088489plp.0 for ; Fri, 05 Oct 2018 09:29:39 -0700 (PDT) In-Reply-To: <20181005161750.179275-1-edumazet@google.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 10/5/18 10:17 AM, Eric Dumazet wrote: > In case ip_fib_metrics_init() returns an error, we better > rewrite rt->fib6_metrics with &dst_default_metrics so that > we do not crash later in ip_fib_metrics_put() > > Fixes: 767a2217533f ("net: common metrics init helper for FIB entries") > Signed-off-by: Eric Dumazet > Reported-by: syzbot Where is syzbot sending the reports? I don't see it on netdev. I would like to understand how it triggered the failure of a 68-byte malloc. > --- > net/ipv6/route.c | 2 ++ > 1 file changed, 2 insertions(+) > > 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; > } > > Reviewed-by: David Ahern Thanks, Eric.