Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5602078pxu; Thu, 22 Oct 2020 06:41:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWYHr63nrk7J9Gf9t18J8Z7EYrwuFPd3KxvQOko8szxHNdGvezUGEUJfLVTh+GaB3JHJsP X-Received: by 2002:aa7:d992:: with SMTP id u18mr2262009eds.284.1603374093646; Thu, 22 Oct 2020 06:41:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603374093; cv=none; d=google.com; s=arc-20160816; b=WZ1NOG4fFl4nI294nKG7wt90z9EvsA/ElkH9TtjJkIH3lntpv9T2YZOQ8QXXvJErQ5 tjaLCk4jYsyWjY9wKLtn3qevuE04Si0nFy7PInaPlOSByYWbWWLKVHERZy4DnZ6Nz36x nht8WLpviLZijZkjbMwJyEGsQeavLbbbhJO9pzv9P/gRZvEwzwgOghkE5Byh0mrD9v3Z D2dyba6yCdsQ2VopImlaveYPABmQsy7O7xHJlqKYifhQ60n8s2DJHGYVw3XttLLusvJQ lf+uhQv/bgrMJ0/ean8VLvm842e1HRcPQC1pELxSOPP9V4sL49gsZR1jGAXW7lL+gcdq hgUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=SAG4hOfEIkfiZwWYt0NBVPbO/dBnoOvfH5V62KacKU0=; b=TooozIxSPHzlGDAf7w3CIKG1j3uK8LWapeF+iOparZGG30l2qCE8DLb8EFj5cN4hqF Hbl4axzhOdFPV+pFQnchRNZTEAsZGq4jtn9E34XAUamqsQbbEtlQbA2+3fGmRjoEiApM 6CrUmOhks+qJzqLVazjnkhos8gLF85QbtgelMR9F+QtLHm7nKPMgvryBE3eXhxFqBXtJ bYrhezPmwuYx+wAjrdRQpLVO5vtYJE6a7zoFj7YK2qrvFhMJL57Rfnz3VyXNDRxGEDUu 3lh+UgISXo8YsIXfgRokAsyOXOfh/s0OEk1NawUqbA5D27op2a/E+mJEbboCGWip2qub 1P4Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di17si907623edb.84.2020.10.22.06.41.11; Thu, 22 Oct 2020 06:41:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2444568AbgJVFmt (ORCPT + 99 others); Thu, 22 Oct 2020 01:42:49 -0400 Received: from spam.zju.edu.cn ([61.164.42.155]:55330 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2437582AbgJVFms (ORCPT ); Thu, 22 Oct 2020 01:42:48 -0400 Received: from localhost.localdomain (unknown [210.32.148.79]) by mail-app2 (Coremail) with SMTP id by_KCgBXX+vKG5FfEIM4AA--.38547S4; Thu, 22 Oct 2020 13:42:37 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: "David S. Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net-veth: Fix memleak in veth_newlink Date: Thu, 22 Oct 2020 13:42:33 +0800 Message-Id: <20201022054233.17326-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: by_KCgBXX+vKG5FfEIM4AA--.38547S4 X-Coremail-Antispam: 1UD129KBjvdXoW5Kry3XFy7WF1fCr4xurWxJFb_yoWxXFbEkr 18WFyxXr1YyFn0kw4j9r43Zryq93Z5XFykJFWvqrZ3CwsrZr9rWryfuF1UJrsxC3yxuFyD AFZ7Xrn7A347GjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbIxFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AK wVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20x vE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4UJVW0owA2z4x0Y4vEx4A2 jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52 x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUGVWU XwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4 8JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY02Avz4vE14v_GrWl42xK82IYc2Ij64vIr41l 42xK82IY6x8ErcxFaVAv8VW8uw4UJr1UMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I 8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWU twCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x 0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Wr1j6rW3Jr1lIxAIcVC2z280aVAF wI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa 7VU1eT5JUUUUU== X-CM-SenderInfo: qrrzjiaqtzq6lmxovvfxof0/1tbiAgABBlZdtQiRQQABsi Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When rtnl_configure_link() fails, peer needs to be freed just like when register_netdevice() fails. Signed-off-by: Dinghao Liu --- drivers/net/veth.c | 2 -- 1 file changed, 2 deletions(-) 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; -- 2.17.1