From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6089FC4360F for ; Mon, 18 Mar 2019 09:32:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2FC742175B for ; Mon, 18 Mar 2019 09:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552901530; bh=O3yJCF0MKkbWFiJt+pEr92/wp61dMXLpXg3MexuNoDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Klkfzbav7mUShP5hB93NkRgjdledOQmVYgrqV5xHl6VAxmkpyOUkinL6isV7+V21X avwl+fiJSDEc14gQoPPfDw6IJDs9VFn1IA/jzGgfdEhbRl2MgJa1JgqwnVVaQ2sqH8 oI4jqjaXkWt3qN96vqW3AQtwjMiYAthbs1OICGOU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728303AbfCRJcI (ORCPT ); Mon, 18 Mar 2019 05:32:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:40082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728676AbfCRJcG (ORCPT ); Mon, 18 Mar 2019 05:32:06 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.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 C9183214D8; Mon, 18 Mar 2019 09:32:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552901525; bh=O3yJCF0MKkbWFiJt+pEr92/wp61dMXLpXg3MexuNoDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o5IOA7y9+VQj/0o8zfqOmO/3eQ1XdtfTZDYk5PQ5A3MT3/nNadcYNZY8FSBrdPzNP WgATFAGC2wnam+ksvN2dyi0JbWJ+ADnTDNJc6QE+o1OOL8YhbmRw8l9R9rhgnOBDMs CphptYB8hgGf1FOFsaeyHbySlqqmYEIPmcag6/xM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianlin Shi , Stefano Brivio , Sabrina Dubroca , Eric Dumazet , "David S. Miller" Subject: [PATCH 4.19 20/52] vxlan: Fix GRO cells race condition between receive and link delete Date: Mon, 18 Mar 2019 10:25:17 +0100 Message-Id: <20190318084015.950944030@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190318084013.532280682@linuxfoundation.org> References: <20190318084013.532280682@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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefano Brivio [ Upstream commit ad6c9986bcb627c7c22b8f9e9a934becc27df87c ] If we receive a packet while deleting a VXLAN device, there's a chance vxlan_rcv() is called at the same time as vxlan_dellink(). This is fine, except that vxlan_dellink() should never ever touch stuff that's still in use, such as the GRO cells list. Otherwise, vxlan_rcv() crashes while queueing packets via gro_cells_receive(). Move the gro_cells_destroy() to vxlan_uninit(), which runs after the RCU grace period is elapsed and nothing needs the gro_cells anymore. This is now done in the same way as commit 8e816df87997 ("geneve: Use GRO cells infrastructure.") originally implemented for GENEVE. Reported-by: Jianlin Shi Fixes: 58ce31cca1ff ("vxlan: GRO support at tunnel layer") Signed-off-by: Stefano Brivio Reviewed-by: Sabrina Dubroca Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/vxlan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -2460,6 +2460,8 @@ static void vxlan_uninit(struct net_devi { struct vxlan_dev *vxlan = netdev_priv(dev); + gro_cells_destroy(&vxlan->gro_cells); + vxlan_fdb_delete_default(vxlan, vxlan->cfg.vni); free_percpu(dev->tstats); @@ -3526,7 +3528,6 @@ static void vxlan_dellink(struct net_dev vxlan_flush(vxlan, true); - gro_cells_destroy(&vxlan->gro_cells); list_del(&vxlan->next); unregister_netdevice_queue(dev, head); }