Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp265742img; Mon, 18 Mar 2019 02:37:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzu5Rf7MFSxRN9gJgqIbxqpRxHOFvviCA4ZD4Qq8Rvw8tSpt9u4hnsvis3SGHik82GAD+9R X-Received: by 2002:a63:88c3:: with SMTP id l186mr262587pgd.148.1552901852789; Mon, 18 Mar 2019 02:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552901852; cv=none; d=google.com; s=arc-20160816; b=ugSAoJUb/4tcluH1lbNAqxhIyjOM9d96ICnUiCDYcvVwQHW4z+MqYFD2z7SGtgcdtp M+r4f2HuipizMumy67RDq9RQH8gUSKrh4qp6CgEDEQXhiZxjla07RVddOribTwEHZQvI uw2O/9lMPUjYYlPF0uYECkr0/ZRnVBO/l3XvY4kTP0svtsL4kSLLj8r92vJYWoWergXH a1qCeOYg5oUHSKAz5/0dC3X8ucK2uGFeRpjEH2OVMH06mCQcSeUpcvJSOy+qJQPV1sk3 m3Z4HqDvAuxAfDV++b40GQ+jMM3Ej7TqTgF0s96mu9fHPuRikxJMGwL4B+0ZZW8Gp6br J2Jw== 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=2yzIyzGRiWzmT47JynDU4TaubQxN43PISmisi29sSIg=; b=sC810giu0/gALwuyDwBENb7KMYxqzpLc0kjX5VgC9BT+fi4E6v+5Zfr0KPZ1Ab4FVq hKOchnJvkgLjILUDyqOjm9QZcqsH/pQH5bj862VLT1ne7+yY/M655oNZV+/VBbaplQHC I2JW6Hoy56byQJ56WLgDTW7vvD7DxaCBxkFgJvSzr31ue3LnuEVZsoKV3DZBU+hdIMZI b48jRKMH6CR5JabkOfRN33BaZtS3v4C5WJYyo5TcoZaaOErp8PUx9wQ77Q7I8su1ES0E 9nMJ0oOT+7asK8blnKeE+o0LxPvAjZxen/WkuTu514axLThifib5KXCk+w9rBcqiaD/Q 0jDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rwxjdnsY; 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 t16si7239476pgh.138.2019.03.18.02.37.18; Mon, 18 Mar 2019 02:37:32 -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=rwxjdnsY; 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 S1729055AbfCRJer (ORCPT + 99 others); Mon, 18 Mar 2019 05:34:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:43156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729040AbfCRJeo (ORCPT ); Mon, 18 Mar 2019 05:34:44 -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 BB2882075C; Mon, 18 Mar 2019 09:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552901683; bh=PKf/J9o5eX5viLjngfPrixCKEt111pOMnrPtBq2t6Cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rwxjdnsYACa1dtW6GMdJ4RKJjbHHG/eO2trNsfKIyQ/0zwCT5gXrcadgdkgkuB3t1 uOUrwTf9HEeYcpzNkJHD9YxFjQbI9wfemDkuvkWZXHZ1AfSpHv5XHSeNLaVfsTOrSj Ghpm5/iK0U8XOf/JWLGpQvwAc55MjwHNrXsg6ISw= 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.14 17/34] vxlan: Fix GRO cells race condition between receive and link delete Date: Mon, 18 Mar 2019 10:25:41 +0100 Message-Id: <20190318084147.070998629@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190318084144.657740413@linuxfoundation.org> References: <20190318084144.657740413@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.14-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 @@ -2462,6 +2462,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); @@ -3523,7 +3525,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); }