Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp300349pxu; Fri, 4 Dec 2020 03:44:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzx34wsgEFW5YG5W+7JOUQgchdtm+XYB2ZQm4Ex5uh/8bjYmTgPchUDjzw2sxOjt9ppY83 X-Received: by 2002:a50:d5d5:: with SMTP id g21mr7314000edj.41.1607082259636; Fri, 04 Dec 2020 03:44:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607082259; cv=none; d=google.com; s=arc-20160816; b=egKR2DYqJ0ZGMlFDpEXo9Mopb8c186zFjXI/e8z249Xd9BeQFoz5iEslJJVMc54Xj4 O81AJn70nvWB3IzhrXyBrpd9YAVD/pm0NtHjureOi+fX7R+txM0lG5C5puI3eUaMRU23 5gnjUiLebEykK/YwXFIxUXqVHCTp3t4SdDOJTg9G8WdA15hYRomTjdgWoi+gyaXCdo3h LClDlkw8w1Aeo/wwPdpqnT5vJ5r7Eru2DSfOoERnHvvvRWTfVWm2XElDDqpXBILi92d0 RRE5o7/x3l6QpjTW6EV40FG8WbIrUnl2ENMKBPmVFcsGF/AlFjzn3l1L36bwgeM9I3m+ nP/Q== 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:date:to:from:subject:message-id; bh=dsRKDxdB31EEN26KFnc9imOQhgVEbRzXsXlDMGXPlMQ=; b=q+KDqzSiNMx5M39RdK+fMwuwsV72Kzrybvr9mUcF3gQEYP4tUpCI9WU5gBaitbjc/w PqsrLEbLJtahyz+bzWORwLCcX06qYVYfisKYAQcqUvhskjMxY25BCWCI29q6dMcgmGEV 38Oa0wKbiiN7gJZeMI69Ktfyp5GP3+EtD3IOBezYo7KrP2hux+UQ9rWoLYl0UhApOJrd lqxiPHk0pacfnODiGSgEVROb2F00sZnpg0/bWYfK+jBMv5DpzwueuStUKOviy4inQV3s r+wlKfLpNZhjQQAelJLvG5ldheZsGem/ga4+haAKWnUH7xeLUgWHyAaaGqBX2BM0C2n+ QYXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r12si689292edw.349.2020.12.04.03.43.45; Fri, 04 Dec 2020 03:44:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730083AbgLDLkN (ORCPT + 99 others); Fri, 4 Dec 2020 06:40:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729196AbgLDLkM (ORCPT ); Fri, 4 Dec 2020 06:40:12 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C68D9C0613D1 for ; Fri, 4 Dec 2020 03:39:32 -0800 (PST) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1kl9Qw-002MuG-9f; Fri, 04 Dec 2020 12:39:30 +0100 Message-ID: <10344296be9a9e4f6f30eb2adf6fa5a3263811cc.camel@sipsolutions.net> Subject: Re: [PATCH v2] nl80211: reset regdom when reloading regdb From: Johannes Berg To: Finn Behrens , linux-wireless@vger.kernel.org Date: Fri, 04 Dec 2020 12:39:29 +0100 In-Reply-To: (sfid-20201126_114222_031269_4F737E8B) References: <8c3e46ac-331b-0922-5379-0cb1ef61a83b@nyantec.com> (sfid-20201126_114222_031269_4F737E8B) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Thu, 2020-11-26 at 11:39 +0100, Finn Behrens wrote: > reset the regdom when NL80211_CMD_RELOAD_REGDB is send Please add a bit more commit message, saying why this is needed. > err = request_firmware(&fw, "regulatory.db", ®_pdev->dev); > - if (err) > + if (err) { > + pr_info("failed to load regulatory.db\n"); > return err; > + } > > if (!valid_regdb(fw->data, fw->size)) { > + pr_info("loaded regulatory.db is malformed or signature is missing/invalid\n"); > err = -ENODATA; > goto out; > } These changes seem unrelated. > @@ -1101,6 +1105,28 @@ int reg_reload_regdb(void) > regdb = db; > rtnl_unlock(); > > + // reset regulatory For whatever reason, the kernel doesn't use C99 comments. > + const struct ieee80211_regdomain *current_regdomain = NULL; This should've given you a compiler warning that you shouldn't declare variables in the middle of the code. > + current_regdomain = get_cfg80211_regdom(); > + > + struct regulatory_request *request = NULL; > + > + request = kzalloc(sizeof(*request), GFP_KERNEL); > + if (!request) { > + err = -ENOMEM; > + goto out; > + } > + > + request->wiphy_idx = WIPHY_IDX_INVALID; > + request->alpha2[0] = current_regdomain->alpha2[0]; > + request->alpha2[1] = current_regdomain->alpha2[1]; > + request->initiator = NL80211_USER_REG_HINT_USER; > + request->user_reg_hint_type = NL80211_USER_REG_HINT_USER; > + request->reload = true; > + > + queue_regulatory_request(request); > Why does it even need to be queued - we're in a process context where we can sleep? johannes