Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4362732pxj; Tue, 8 Jun 2021 12:26:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXk2EATc0EStILbNR1iAP1v4WBbIrnr96gY9sN2EU5K+nIDja1cbEPf8hUUIdcBHHrnVQ0 X-Received: by 2002:aa7:c445:: with SMTP id n5mr27234164edr.64.1623180385468; Tue, 08 Jun 2021 12:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623180385; cv=none; d=google.com; s=arc-20160816; b=zbANiVLd1GBNCV+RvbwRFQ5DD06YqGM8j6DifHEiBFELlrCpZ+ul08H95YDGSpsxvk SLc7U4iUt6REOXSy164NQjrEM/rO+Qi/ugiU7HfmmFOJ+CvyBMbeyw10GOd+Hfqa+opg dPT0//eqk24iH4GJRBbThVoWwfjvyGYlncKoyVv8lkr5G32jPFD8fBGxUT8ozGzXLY/e DUZvUOYYehX3DSn/wL1XzN7PXj+LKuKp+3roH8/3InPSxq9ZblV3PTJICiW0+YPWR4R8 PDcaVAXExFDrdOZjCAgXCfocBg42Kvno8JvkV4ukHf6PbOpCKPziGzOUQ3ByP+rn+w4z Ec2g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uzUv3C7lBHQr1geg8Ub36SmmFRG+oK2Zfa1YNYuSl40=; b=bd30ZtAScswZpLq9etnmsE+dauBoCSc4AzUlsapnpUWHV6NO/rw1ZxfiVg+7mfhsE2 wSYt0mCmCBatMakJsGYSgYehTwKOmSHUVn0RueYHwzjONBoqdbwqQ+3Jql34PmRmvs1d 6CevujvIY3KGBn034msIx7drxQ9R+11U260LJmupCGfunqzs0vhg1hGF558IhO1HXAiW yq3f+kG2guZAeglbwy4TvDkitgmK0Y/yeeAbpazTYdzqbJkiX2gk2Q5ISaRGjDLXYx/P ZLt4aEDYWP/15eG6+yt715fzSWhEv1LQZCbVV1HMnw8/dt8NeU2NyC1yzwE8zfCWcc/u QFjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JfxGsNcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si439060ejb.163.2021.06.08.12.26.02; Tue, 08 Jun 2021 12:26:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=JfxGsNcA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239564AbhFHTYl (ORCPT + 99 others); Tue, 8 Jun 2021 15:24:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:35256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235925AbhFHTMB (ORCPT ); Tue, 8 Jun 2021 15:12:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E3AB06194A; Tue, 8 Jun 2021 18:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623178157; bh=CAnlmVg2OB/1ByO4Wsm94f5zmagty4A3TeD/u65t30k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JfxGsNcA0Yx/5iFUu0noBiaalewnb6Y3ehEKq4lqN1lw+B4g61kNjn/vIugj0hCxg wlVlwToWI8gh6mY5CTv7yArxpoxrJWp8QMtr1Cp+qAZmlwkkGsH7Gj8ujY36fxAT8+ t/ys5qJvwvgh0plasweVWwUxGcwzXcZj+ftJzzNM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , "David S. Miller" Subject: [PATCH 5.12 099/161] wireguard: allowedips: initialize list head in selftest Date: Tue, 8 Jun 2021 20:27:09 +0200 Message-Id: <20210608175948.806991696@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175945.476074951@linuxfoundation.org> References: <20210608175945.476074951@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason A. Donenfeld commit 46cfe8eee285cde465b420637507884551f5d7ca upstream. 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireguard/selftest/allowedips.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- 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,