Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5791831pxu; Thu, 22 Oct 2020 11:07:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcvuALxjwoTvmgFlFNKgZtcaQ5TWFpSPgBTahIp3zZF7FoEfAOrRR8I7Z+/PnAQ6XSWi4S X-Received: by 2002:adf:fd47:: with SMTP id h7mr3977403wrs.245.1603390031811; Thu, 22 Oct 2020 11:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603390031; cv=none; d=google.com; s=arc-20160816; b=xSa1AkLZ51G+Wxc3TTJg8ltdjZJQ8zphCVnERI2rKzf0u/CH+iWgN7vH99NAgFFu2e Bvt62VnMk2RJFT5YdxqXLP7IV5tzXimLXtBHjlihe3PSxquikSsWBHqb0JMOLcSu234k XOz3gd/zE+8lPNE9YVsd4U0CBW9didjUDG895sFVySbvXNP3YUCgYEcAKxNpguq1seOQ 9hd3Utx8M0CeUZdKkTqqZUbDYZ+oH6rbQ6w6Z5IK7N4VPm2BiKkO7LJ44fsG7FaRlqsB GukM+ujWXijto+ruIKqm2po2MQyCX4Tum9qpemV3EOX6lmckk3mvq2+6Jwz9djn6PiVr s93Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=F1qoNPFka5NDTExCMLIbOcyijELz0zWMEPIsWbZ1yKU=; b=DmoHnFIHKgQiONoaKhj0+AkSmc834fzUuuwgtaoa+GMl7MY6NhEeA+GLCmkNea02iv 8YDluZwJ+GwMeIExLYQbiv4MONSr3nzxdvw8m09ThdTIdBbbPi6bPUL8abPDD86w/m6v cnxkJsZiHQF27owaUsHVZQ6PzB/tp76f5Q4HEPJJz3LomGd1ccgMY8M+jVEA+ZokeXFq T1ZjCVP00tRb4hgEqTg8046uRyntk+juOasHVU1Ow4+7r1qXwjlLoBOxv0vVdIEgD9vX 8TD86BbjI7l90Z2FU2IyYzM9aehbPczRhsJZ2ofwkHkbC4xHSnoJPpNkvK9N5fLZN1za COGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="V/nkcAz9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id da5si1820630edb.595.2020.10.22.11.06.48; Thu, 22 Oct 2020 11:07:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="V/nkcAz9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2896135AbgJVQMO (ORCPT + 99 others); Thu, 22 Oct 2020 12:12:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:56750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2895999AbgJVQMN (ORCPT ); Thu, 22 Oct 2020 12:12:13 -0400 Received: from kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net (unknown [163.114.132.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA05824182; Thu, 22 Oct 2020 16:12:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603383133; bh=eJVSOn8Oqy+L/zRqcwCFZVv32OM/ZwNLPnS+CsjA1q0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=V/nkcAz9gUtrgfJMEToeUNW3zJ99V2amJpgd1IOXluaghpeaSFQwuWpBLIbCUMgA1 2ERCg63W1JAbFGfWSZu/XYjw1klosk3Jztw791cHxG4EgIccP7jbYl8v9oiDmHhuUe JDaWh/noy1VSmXrlUPUg6vDDdXro5tUt01v8J+Bs= Date: Thu, 22 Oct 2020 09:12:11 -0700 From: Jakub Kicinski To: Dinghao Liu Cc: kjlu@umn.edu, "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net-veth: Fix memleak in veth_newlink Message-ID: <20201022091211.2a86355c@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20201022054233.17326-1-dinghao.liu@zju.edu.cn> References: <20201022054233.17326-1-dinghao.liu@zju.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Oct 2020 13:42:33 +0800 Dinghao Liu wrote: > When rtnl_configure_link() fails, peer needs to be > freed just like when register_netdevice() fails. > > Signed-off-by: Dinghao Liu Can you see this leak or are you just sending this based on your reading of the code? netdev should be freed by the core: static void veth_setup(struct net_device *dev) { ether_setup(dev); [...] dev->needs_free_netdev = true; > diff --git a/drivers/net/veth.c b/drivers/net/veth.c > index 8c737668008a..6c68094399cc 100644 > --- a/drivers/net/veth.c > +++ b/drivers/net/veth.c > @@ -1405,8 +1405,6 @@ static int veth_newlink(struct net *src_net, struct net_device *dev, > /* nothing to do */ > err_configure_peer: > unregister_netdevice(peer); > - return err; > - > err_register_peer: > free_netdev(peer); > return err;