Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp510970yba; Mon, 1 Apr 2019 10:45:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDm+0QPV6cFBA+iwczyRgFRPGNAOSOYfGy4uAr2RrKYocqYDZD99KEY91bou29Vcm6BZGH X-Received: by 2002:a17:902:f094:: with SMTP id go20mr42652388plb.159.1554140730074; Mon, 01 Apr 2019 10:45:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554140730; cv=none; d=google.com; s=arc-20160816; b=PzNpcPsL3KiTWRluArJFkBhBiw9T9Oe0p7AOM4rzrE5PC5fr8eAhD9Eqbj2eL4svhE +JW9S2roQF7kXHdlcr2yiiP+90wiIj09cfmFfGNfc4Zb6QBrqt4jXYnEgF3wqwXZ8vCa +rIt/iPCU5sMdHOVZZuBkpVOY09hlGJbsqNtWtos2i+WCJI4osUZjNgEPG4eFD0EbXk1 ARa/FMv+SmTcQIo2iFTrxj/I/TWSkiCEE8R6Wq0pQgmRpUUeLeOvJ4PFaV1fOXp+YVcb TUGKxGlZv5fROlfmLNpRi3JC+eqDzpMJGoLsjS6Hsm8yG4May7jvNbSWumzxB8wr6m+Q 8YyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UAVZV0WJWQCjWNVb+7+i54U3baEMIoCR0eLu2pjeq8A=; b=Kt/uTbBlwR26Zt+21Bi12qisAhDhww7HAV+0HWngLDA7rzYFuLEQs9OFkDjIzkbZ2W p2m9lKkNteWY2PRHhhV2o9qOGyPFXnybLrWRWgBl0h9CF+7xo8rOX/RkKIFgL9ICLUIW Tk3ynVi2v9IWxAy1go3MChJrQqoiEynsKeFh2Z2YCi+fbSvl8cceRdUxX33WGtqkfP/5 H/v/trXtL2rdY9qpoG3C8yuvrVtmN3HxZWZIuC/XkbegJmmtw5lya2w1GgIH0u6ZhvUy XrBTbn2C6wCmwHt+mNapGVJLg6x/HaFCe+v13KFIWzcj5/PX6Qdd2Xua/3cuKdh52x+L vhcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d7I6CcoP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e26si8942088pfi.54.2019.04.01.10.45.14; Mon, 01 Apr 2019 10:45:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d7I6CcoP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387792AbfDARea (ORCPT + 99 others); Mon, 1 Apr 2019 13:34:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:44316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732336AbfDARe2 (ORCPT ); Mon, 1 Apr 2019 13:34:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 2B3C52070B; Mon, 1 Apr 2019 17:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554140067; bh=62cm1nDvXuc3HevqN/F6dU6arBuiVKKo8Jk3GO4k7QE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d7I6CcoPRJPO/AdHT+DRBYxqiUbzyMoICu7cpyhbgw7fj69ct8Ybedcx5IU8Gx1eN Rf1VGdWS0QQkVpMFpIuSZtDoV0hXUS0GuRJWFqpD4IMwHbILRbP7SKdg+gEq6TlTlC AM3uPNrMN9/CMpTM3SAPG0VXsVUDGgAwv3JTfz9o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Suanming.Mou" , Eric Dumazet , Stefano Brivio , Zhiqiang Liu , "David S. Miller" Subject: [PATCH 4.4 097/131] vxlan: Dont call gro_cells_destroy() before device is unregistered Date: Mon, 1 Apr 2019 19:02:47 +0200 Message-Id: <20190401170100.039377202@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401170051.645954551@linuxfoundation.org> References: <20190401170051.645954551@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhiqiang Liu [ Upstream commit cc4807bb609230d8959fd732b0bf3bd4c2de8eac ] Commit ad6c9986bcb62 ("vxlan: Fix GRO cells race condition between receive and link delete") fixed a race condition for the typical case a vxlan device is dismantled from the current netns. But if a netns is dismantled, vxlan_destroy_tunnels() is called to schedule a unregister_netdevice_queue() of all the vxlan tunnels that are related to this netns. In vxlan_destroy_tunnels(), gro_cells_destroy() is called and finished before unregister_netdevice_queue(). This means that the gro_cells_destroy() call is done too soon, for the same reasons explained in above commit. So we need to fully respect the RCU rules, and thus must remove the gro_cells_destroy() call or risk use after-free. Fixes: 58ce31cca1ff ("vxlan: GRO support at tunnel layer") Signed-off-by: Suanming.Mou Suggested-by: Eric Dumazet Reviewed-by: Stefano Brivio Reviewed-by: Zhiqiang Liu Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/vxlan.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3276,10 +3276,8 @@ static void __net_exit vxlan_exit_net(st /* If vxlan->dev is in the same netns, it has already been added * to the list by the previous loop. */ - if (!net_eq(dev_net(vxlan->dev), net)) { - gro_cells_destroy(&vxlan->gro_cells); + if (!net_eq(dev_net(vxlan->dev), net)) unregister_netdevice_queue(vxlan->dev, &list); - } } unregister_netdevice_many(&list);