Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp657665ybg; Thu, 19 Mar 2020 06:31:57 -0700 (PDT) X-Google-Smtp-Source: ADFU+vunPWAfygKy74Z4Iox69xoUs64MngfgV9YDGaFCqxCqtL+fAEnz7vDpjL5++S0OmDM89dRe X-Received: by 2002:a05:6830:22c3:: with SMTP id q3mr2245568otc.212.1584624717040; Thu, 19 Mar 2020 06:31:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584624717; cv=none; d=google.com; s=arc-20160816; b=X1pr2fl5hdTG6FW3CfnjXxTxM2PgVF2tOHI0hI9zEo1K8/+H03uMJu25fjQb5AHfN2 VNtrIdZ2xQb4yA0dtMx0bsrQbpY8Wv5Bsy8DXLuf3FjAm4Fp+o3W/T8mOy7iyg++HOuS gQOhQ7CwPMyMM4UDcBAjPoAM7t+KWOo0QMtt7+NuBwDpJIFphBRsUYU5Lc8oGgalPcLF OromtUyGA2YKw444x6CTBkXvpMUQZPTDNcL0oQ+JMrAiM5CNsNzAUmgIS8jqjkWyo7XF PXoqTM0db0/AyTVH1BIR1aXRFBI+UIWGH+LZ4JrUrO1S6RpNf3YDJDUYzG1WzQ0fRTVZ n++A== 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=Dd1klShLwePlNJLEhlzlKDGWJbgsv/BDJ/FU4lupjdA=; b=GYXeTuOfHMx709aZQlbWarZXRrKLOyBYpneY4vlNvGGgm+ESJ+tqjAVV6PnzIShGQL 2zLlSK6KWmMy+TTBFlzJRizPnm2pLfGUoU7ZdF5SjpPanH4FEptg1nDOY1VaQ7o63Pdp pkmNSBuSKl2dRmihbuSYLGBBffDno61yHFooZR2rNa8tEJ+ngkU+z+hFWA6EwOq+am0a 0DzQkSHtcq5ETrsuFMAPmMnSzdMBaTe9cHjdd53bL5/pHsd/ryPhTjPTqEfz47r9XpS0 +JsyyzxBnDYfu4O2axcN1+G/KG0MqWTvbexrcdF5SAqZSPvU2Ud2hh+BBQM8V//O0yyy Jfhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="jx4sTb/G"; 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 j11si1157015ota.85.2020.03.19.06.31.44; Thu, 19 Mar 2020 06:31:57 -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="jx4sTb/G"; 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 S1729747AbgCSNSE (ORCPT + 99 others); Thu, 19 Mar 2020 09:18:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729566AbgCSNSD (ORCPT ); Thu, 19 Mar 2020 09:18:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 998D9206D7; Thu, 19 Mar 2020 13:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584623883; bh=mwst+dBFMWQvD2GtYzncPLfCVIHE0q3HaiZ5TbF0oAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jx4sTb/GP6TAplwtG6uZGr7D5JfR+afT9TkdmsknexV2cHSIuI+oMXIrj3scPQvl4 KoBeWkqWJ7VBSasr0rHRZz4B5XaqRW1eE0Cy1ES9cu+798q7v6WRyo3HYlxDe9PQy4 n/g3TjSsIeTCkhCrJ+SQYEZMuuM0zv4Ep13bHMOU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Sasha Levin Subject: [PATCH 4.14 86/99] cfg80211: check reg_rule for NULL in handle_channel_custom() Date: Thu, 19 Mar 2020 14:04:04 +0100 Message-Id: <20200319124006.242387577@linuxfoundation.org> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200319123941.630731708@linuxfoundation.org> References: <20200319123941.630731708@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Johannes Berg [ Upstream commit a7ee7d44b57c9ae174088e53a668852b7f4f452d ] We may end up with a NULL reg_rule after the loop in handle_channel_custom() if the bandwidth didn't fit, check if this is the case and bail out if so. Signed-off-by: Johannes Berg Link: https://lore.kernel.org/r/20200221104449.3b558a50201c.I4ad3725c4dacaefd2d18d3cc65ba6d18acd5dbfe@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/wireless/reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index a520f433d4765..b95d1c2bdef7e 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -1733,7 +1733,7 @@ static void handle_channel_custom(struct wiphy *wiphy, break; } - if (IS_ERR(reg_rule)) { + if (IS_ERR_OR_NULL(reg_rule)) { pr_debug("Disabling freq %d MHz as custom regd has no rule that fits it\n", chan->center_freq); if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { -- 2.20.1