From patchwork Thu Jul 18 15:38:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 260082 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B12D52C0079 for ; Fri, 19 Jul 2013 01:46:37 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758789Ab3GRPqe (ORCPT ); Thu, 18 Jul 2013 11:46:34 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:50734 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758607Ab3GRPqd (ORCPT ); Thu, 18 Jul 2013 11:46:33 -0400 Received: by mail-pa0-f43.google.com with SMTP id hz11so3341261pad.30 for ; Thu, 18 Jul 2013 08:46:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:x-mailer:mime-version :content-type:content-transfer-encoding:x-gm-message-state; bh=kiV6Rb6W1SDkFPZuaGAYFOo0Oxgr8VlUeb/8ZsJOj2g=; b=fQct8R2azfOi7C0MqLhocNBAwBS46Q/s6C6JC2y7INQRYXK0A7NEkxbpNssdRFtH3m FIRd0i1HMflx4gBetF84M26TwIKE4A+/73UjW89Jqy4xd/GSzDs28tMDByLpvvErNcYH CjfiXx1xbbctAqr+d49vmaZfe3LP8pxc+HMQgp1PGi9BiWJuTBc5mJM0Il1d/1GnvdBi NTlpeSCI47pf2p/WaSlpxiI+d0z4xAs4UNogGpaMKOF23R/B5y1jJVjP6NPkqvTcSVQR io9qdmpCV+uAtw0ptxSgG2B0OOxP2qDKivVfZL2IBH7HXyliNE91C2eNcd7jb8Fv+dQR tvDA== X-Received: by 10.68.35.131 with SMTP id h3mr12682704pbj.140.1374162392583; Thu, 18 Jul 2013 08:46:32 -0700 (PDT) Received: from nehalam.linuxnetplumber.net (static-50-53-71-109.bvtn.or.frontiernet.net. [50.53.71.109]) by mx.google.com with ESMTPSA id qg10sm14520034pbb.2.2013.07.18.08.46.31 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Jul 2013 08:46:32 -0700 (PDT) Date: Thu, 18 Jul 2013 08:38:26 -0700 From: Stephen Hemminger To: David Miller , Pravin Shelar Cc: netdev@vger.kernel.org Subject: [PATCH net 1/2] vxlan: unregister on namespace exit Message-ID: <20130718083826.58ae2b77@nehalam.linuxnetplumber.net> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Gm-Message-State: ALoCoQnG34uKo4sbwhzDAT1HLyD22kG0qMJ4ghWblIWxXYREcGI7mRnBcCyKtSNwCVgYNOSuKm7m Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Fix memory leaks and other badness from VXLAN network namespace teardown. When network namespace is removed, all the vxlan devices should be unregistered (not closed). Signed-off-by: Stephen Hemminger Reviewed-by: Pravin B Shelar --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/net/vxlan.c 2013-07-17 16:32:10.826955800 -0700 +++ b/drivers/net/vxlan.c 2013-07-17 16:47:35.275690741 -0700 @@ -1878,10 +1878,12 @@ static __net_exit void vxlan_exit_net(st { struct vxlan_net *vn = net_generic(net, vxlan_net_id); struct vxlan_dev *vxlan; + LIST_HEAD(list); rtnl_lock(); - list_for_each_entry(vxlan, &vn->vxlan_list, next) - dev_close(vxlan->dev); + list_for_each_entry(vxlan, &vn->vxlan_list, next) + unregister_netdevice_queue(vxlan->dev, &list); + unregister_netdevice_many(&list); rtnl_unlock(); }