From patchwork Fri Jun 4 15:17:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 454045 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp508389jae; Fri, 4 Jun 2021 08:18:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNAgPP5N+JRdJM6V4XRTJSB1r9m8dUfW7+kceSmTz57udCDoH42/rjYk63JurOKLWKOVv/ X-Received: by 2002:aa7:d5d6:: with SMTP id d22mr5201016eds.302.1622819931937; Fri, 04 Jun 2021 08:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622819931; cv=none; d=google.com; s=arc-20160816; b=gu2S7NhbUYiS94PhAacUnOu973QoFu8PtY+dxW/TZeFjyLLL+YVU9bJNThbp4R6TWy ivPSmDXqFvlIZsTmaefGDOcIW8hnsM0uVkuEfZdbb4kQCRu+RhgHzy/CckSOUmimEKi4 ssKNIawUOhfInFCpl9ySDicxmm8SdiC4Vfp2wr/zsboxfUc9j02MAyQx2yBZKR+sxri5 XHuC3h1ps5SWQ1cOlPLrY7HkvN9b9lku0b8lw2+m7GDMjzWxn+tUidZHu7k1CmqOM/kq 5Ux/DFD9X3JNbb4Hz+n3mtuJoaF8eDrlDuBlHi7TnhCzXUeSogy6q1P6lRHxTEVNiXMU NRZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8N0Fk94XQEKy2fk7aF/Vhnx+Uu/pat84MbHqxv22CaE=; b=pix99ENtYeUpZfaEAWi6ti7vnOt+iWzKPHkItc8kk1vLbnMxZuUAwa2FsyMGCzJ9tl VuFYFTR4PoUxI7K3Kw5uTYOk8ccOtS/KEeCy53KO8k3dY2drElMNWXpNJEXZHHSg6R4M hLNofOBiOOUNLa5des1+cJvJTLe8LUH2fF5RO+6CL/Ry597/Tn63P0VNAMcXDKICanX5 jiyDmgobFtRG/HXm2n7EYkWZRnpYuFWBWLfgsonb53NEmcNkjq7DJwp4zKjdfQxxn7Xg 1trgXH285Og1VcIH7/TqMIAt3+ypJbD8VtVMavjV9k/ZvKnV3N9uyg4HuwKjX4EHMqia vHYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=XDtvQcg+; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si4894987ejc.521.2021.06.04.08.18.51; Fri, 04 Jun 2021 08:18:51 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=XDtvQcg+; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230394AbhFDPUB (ORCPT + 12 others); Fri, 4 Jun 2021 11:20:01 -0400 Received: from mail.zx2c4.com ([104.131.123.232]:54988 "EHLO mail.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbhFDPUB (ORCPT ); Fri, 4 Jun 2021 11:20:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1622819889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8N0Fk94XQEKy2fk7aF/Vhnx+Uu/pat84MbHqxv22CaE=; b=XDtvQcg+bjXtf8pgWiLbyiYgq0WB64kVllnsnS55AemklCOhibeV2Ne5TSZPEovBf5bREe ac4cMk6XcBsXUa5Oz1NsYWm5WWfs5ACfKzERFOFZuejYmSwObk23TwVJAH1Xa+3XaG6bmh Xbn/g/wLECyxPEhWI/G07XitG51II3o= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 82391298 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Fri, 4 Jun 2021 15:18:08 +0000 (UTC) From: "Jason A. Donenfeld" To: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Cc: "Jason A. Donenfeld" , stable@vger.kernel.org Subject: [PATCH net 6/9] wireguard: allowedips: initialize list head in selftest Date: Fri, 4 Jun 2021 17:17:35 +0200 Message-Id: <20210604151738.220232-7-Jason@zx2c4.com> In-Reply-To: <20210604151738.220232-1-Jason@zx2c4.com> References: <20210604151738.220232-1-Jason@zx2c4.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The randomized trie tests weren't initializing the dummy peer list head, resulting in a NULL pointer dereference when used. Fix this by initializing it in the randomized trie test, just like we do for the static unit test. While we're at it, all of the other strings like this have the word "self-test", so add it to the missing place here. Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Cc: stable@vger.kernel.org Signed-off-by: Jason A. Donenfeld --- drivers/net/wireguard/selftest/allowedips.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.31.1 diff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wireguard/selftest/allowedips.c index 846db14cb046..0d2a43a2d400 100644 --- a/drivers/net/wireguard/selftest/allowedips.c +++ b/drivers/net/wireguard/selftest/allowedips.c @@ -296,6 +296,7 @@ static __init bool randomized_test(void) goto free; } kref_init(&peers[i]->refcount); + INIT_LIST_HEAD(&peers[i]->allowedips_list); } mutex_lock(&mutex); @@ -333,7 +334,7 @@ static __init bool randomized_test(void) if (wg_allowedips_insert_v4(&t, (struct in_addr *)mutated, cidr, peer, &mutex) < 0) { - pr_err("allowedips random malloc: FAIL\n"); + pr_err("allowedips random self-test malloc: FAIL\n"); goto free_locked; } if (horrible_allowedips_insert_v4(&h,