From patchwork Tue Sep 8 15:26:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 264286 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3AFEC2BC11 for ; Tue, 8 Sep 2020 18:06:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 726ED2080A for ; Tue, 8 Sep 2020 18:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599588405; bh=e9WJCK5h35QdVgPJQzxQpC7m4BWtaGhxmc/XG81Dzhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AExL+anYC5sgH8hFX84OBb7CX3BmwAEdklS5Vzy4JUVI2ZqrI9GkVyEcI/1oa9yPt 2bhfR5Wnj2wyXDUWpREEMqgGhWhAaeIcmKX3022SrBWvp2Sm8Nzq1xwIMqEG+hdskJ cl8r7Lw201f6PMrRGv248lJ0bSbSEFpCG3zwZhCU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732228AbgIHSGl (ORCPT ); Tue, 8 Sep 2020 14:06:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:55372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731511AbgIHQLz (ORCPT ); Tue, 8 Sep 2020 12:11:55 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 4A45524744; Tue, 8 Sep 2020 15:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580242; bh=e9WJCK5h35QdVgPJQzxQpC7m4BWtaGhxmc/XG81Dzhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QiHU49rS2sTjpK4hXsRfzw/R5M7txcTIr8LCZSmMCjJ+uyFjViFo7ja9VyQnQHNbT hs7+Q7RnEjbSBg2MPGY7ORwxS97Xy5+i0pK5ZAYBeHEREojaVCQ0evhwwUW7+RrJW8 DiUG6iZyYlIh/Kk+O08nNYj5jnEu08O9WAfubrGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+d451401ffd00a60677ee@syzkaller.appspotmail.com, Johannes Berg Subject: [PATCH 4.19 87/88] cfg80211: regulatory: reject invalid hints Date: Tue, 8 Sep 2020 17:26:28 +0200 Message-Id: <20200908152225.559306868@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152221.082184905@linuxfoundation.org> References: <20200908152221.082184905@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Johannes Berg commit 47caf685a6854593348f216e0b489b71c10cbe03 upstream. Reject invalid hints early in order to not cause a kernel WARN later if they're restored to or similar. Reported-by: syzbot+d451401ffd00a60677ee@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=d451401ffd00a60677ee Link: https://lore.kernel.org/r/20200819084648.13956-1-johannes@sipsolutions.net Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/reg.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2936,6 +2936,9 @@ int regulatory_hint_user(const char *alp if (WARN_ON(!alpha2)) return -EINVAL; + if (!is_world_regdom(alpha2) && !is_an_alpha2(alpha2)) + return -EINVAL; + request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); if (!request) return -ENOMEM;