Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp60701imm; Tue, 18 Sep 2018 16:34:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbjBC3EQLM3Fqku4oXrpd5apgEbjKivnTyLpqAJi8AzuI1GxboOTORY8rnpk5t+xZVmjKZ+ X-Received: by 2002:a63:4c02:: with SMTP id z2-v6mr30473617pga.312.1537313679512; Tue, 18 Sep 2018 16:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537313679; cv=none; d=google.com; s=arc-20160816; b=FS8iF5TyQpK5lnaeFJoOfEMHh6+m3o9pkd61Rp6IgvM8vyb5uWM6nepsLkc+7uHBJV fQ1oGIu9YNSZDq4pLjDBfM4q3ZTRkdFeWei5u24jJCjPDKy+K86rla0thNXbiZ3icUYz XzsisYC4k0fkPY3yaHendWIujE6vpZxxk5aFfpUPBbcNpFlO3+rYuCqXZq2LjvfVB+7j g5+tjB1Ot80hsK6vtZsg0KWr4aflX94HEXp2HlGkv5qj7xaUDRlIlfHyUT4XUPra3DUq G2CefiFQG07HY4POO1d6O53bwWDR5ogStQJxPf1jBlevSD06CDp8ySU5sjgB0KpO31V6 64LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=77NKSh5AejSBCDfkHAPAXmt6dWtQYE/qJkV2jp49roE=; b=P/4FAj2Zdl5R3mdd/hXRli4G7OOChACYr6Iysezoe44voDiYQnSa8Yp1xWHW2CmmaS QA6QgTXTqqgK06n5Q9CcbI7kNCjVUTxMFv5hb41jZEwJyXUjY/L0uy11eZD5QmQ/R89x aMz9/64MyyUZh5lVVXeRIvxItnHFoTu7Dtl0fy1hCjgCla4ip/Xe5fqzPgrEp8YTKTc1 Hutah72wIn6i/LOg7zTRgT/P0O9MYSHpSlCI+tEs5HvYwrnkneJNgLmusKW/pBdRsnbN OK/UsKUafmkQBaiGgzjzVzz1wnl7/77ZToSX9RaaCH0Xb93ma3R8JQ0BhelaZcstpeLx MlFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=lb6Y6O5K; 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 d31-v6si19626830pla.479.2018.09.18.16.34.23; Tue, 18 Sep 2018 16:34:39 -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=@lunn.ch header.s=20171124 header.b=lb6Y6O5K; 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 S1730526AbeISFJL (ORCPT + 99 others); Wed, 19 Sep 2018 01:09:11 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:38214 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726960AbeISFJL (ORCPT ); Wed, 19 Sep 2018 01:09:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=77NKSh5AejSBCDfkHAPAXmt6dWtQYE/qJkV2jp49roE=; b=lb6Y6O5KpN8LESWwJBkzFSt6CZzHrV5KPGSx5mPwfTsZ5WN5P0ZRRf+hAqhIEO5uPlS+hdlis/orSN/DD9wZ467Ppe8HcMvJA5e/g3Fbe9ZwDD8IXgIHNPwEZ0d11P8NYuQPhpw3q9MqQMeEYxrFp5AAVKcwcLqRC/47YiYufXg=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1g2PVT-0003mM-DO; Wed, 19 Sep 2018 01:34:11 +0200 Date: Wed, 19 Sep 2018 01:34:11 +0200 From: Andrew Lunn To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-crypto@vger.kernel.org, davem@davemloft.net, gregkh@linuxfoundation.org Subject: Re: [PATCH net-next v5 20/20] net: WireGuard secure network tunnel Message-ID: <20180918233411.GB17466@lunn.ch> References: <20180918161646.19105-1-Jason@zx2c4.com> <20180918161646.19105-21-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180918161646.19105-21-Jason@zx2c4.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +#define push_rcu(stack, p, len) ({ \ > + if (rcu_access_pointer(p)) { \ > + BUG_ON(len >= 128); \ > + stack[len++] = rcu_dereference_raw(p); \ > + } \ > + true; \ > + }) > +static void root_free_rcu(struct rcu_head *rcu) > +{ > + struct allowedips_node *node, *stack[128] = { > + container_of(rcu, struct allowedips_node, rcu) }; > + unsigned int len = 1; > + > + while (len > 0 && (node = stack[--len]) && > + push_rcu(stack, node->bit[0], len) && > + push_rcu(stack, node->bit[1], len)) > + kfree(node); > +} Hi Jason I see this BUG_ON() is still here. It really needs to be removed. It does not look like you need to crash the kernel here. Can you add in a test of len >= 128, do a WARN and then return. I think you then leak some memory, but i would much prefer that to a crashed machine. Andrew