Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2189775rwd; Thu, 15 Jun 2023 23:56:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/3N++jRPZDqNAi655GUeyXhq7EQ+9B8kzntlFo0BvnvyCHvdKP43eR2W8kXFvzsfVATK4 X-Received: by 2002:a05:620a:2048:b0:75d:dbc3:507 with SMTP id d8-20020a05620a204800b0075ddbc30507mr928854qka.43.1686898606428; Thu, 15 Jun 2023 23:56:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686898606; cv=none; d=google.com; s=arc-20160816; b=UG7xKrj97aBJPPAQn+2MkmN4VF6Jj+vq7y6TRTAFkNFqzk9tEhzHdSxOhGa8RIQtMZ 3Owk7/ADWp4a0RMikjMM18Jt1p52osVqRHq+OSKyx5rFuy6kkuJImX84U4HnlC0SRXVU kfbVIGzfW8U/bDmPvoDHUvx+GWoylTfSN+VDlk6ijAwbxIoM6Y9TztFv6QVb3abhyn0S JxmZdpw3noBWFMyxVVHv9GV6AVGd9U2KjwvAxl9fvVHOGIVlHz634oT9xqFhCywYyFEe yLj2X8Y7mfn0IyNXADDt5kUy23RxzT/5Ww4lToTRp+hipsfubBc3cP/1sk2i39eQ8JBS yoMQ== 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=sd0vsi1VmPI4uWp0ZzsmoLpNCl66RdAuXR06q8RBtj8=; b=P931FyN2tIWodasP/b0/XLCSXCpoO198yofOcI8tOhLMHJB3Q+oueDkCzFyShtjXmn qqGazK945QTcoQ1yN1zSMsXuV9FFWJqGqFvi3N0LxtIHNym32pSEHKeGaC0aXrdPUjUQ T/48ry94bh5HWFL6GibfLrLXbtc/qaljX9t4qaMIi+nsGXPo67DEinVoLI9BBihV8Ncl lGtBTZg7AHpnvUepdiQRlf87IKbyrCrakuc/h1dPTzofCpkpFrUabPcZ4EmZiuak5umB 0cuzZMVdS2hYEah6CUwvTv9QwIVpZJ1VPgeyrM7qyG4ROWa0xLf6sJTDCMihyliISUY+ KcRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=H73B5ZJZ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t16-20020a63b250000000b0053f265b0ef2si1829153pgo.471.2023.06.15.23.56.39; Thu, 15 Jun 2023 23:56:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=H73B5ZJZ; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231452AbjFPGy7 (ORCPT + 61 others); Fri, 16 Jun 2023 02:54:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243313AbjFPGyq (ORCPT ); Fri, 16 Jun 2023 02:54:46 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27C9B1FE8 for ; Thu, 15 Jun 2023 23:54:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686898485; x=1718434485; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bSiwSDUtBRojHisQFABP50ysAph75Bvd/nyXMbVHAQY=; b=H73B5ZJZtPtNPol67L2CGerJPHd5j1HCCZQCbKDN0Wj5tz5GWZyKR/RN FMLabMW2stwRriCMPo4hVfcEOKfmpw9xggej7nCLc3u8Z3eW6nUpQ0hv8 28TwkORUSwo+9fMnoammdyQ4dW+Tj8qRTfMMaXim5Z69CezJWXDo/yqRO SbizW1z0Mh5stGCcJe/3K3k3pan/TS8/G3DicW21M1Yq3tGK0y+n7yZ7E N/Vpvvbta55jGta8NIWX4w7lc/XHWz+TQCjeX+LljOEaj9jyzfOc3Vsz1 rlFwbOPFbYFwKddEPXBp7am0REavhXVXittfAikIBjcoDEF2bbsSzzW4g A==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="425078859" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="425078859" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 23:54:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="802720061" X-IronPort-AV: E=Sophos;i="6.00,246,1681196400"; d="scan'208";a="802720061" Received: from ereznaim-mobl.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.214.237.118]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2023 23:54:38 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Anjaneyulu , Gregory Greenman Subject: [PATCH 07/20] wifi: mac80211: add consistency check for compat chandef Date: Fri, 16 Jun 2023 09:53:56 +0300 Message-Id: <20230616094948.ae0f10dfd36b.Iea98c74aeb87bf6ef49f6d0c8687bba0dbea2abd@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230616065409.633290-1-gregory.greenman@intel.com> References: <20230616065409.633290-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Anjaneyulu Add NULL check for compat variable to avoid crash in cfg80211_chandef_compatible() if it got called with some mixed up channel context where not all the users compatible with each other, which shouldn't happen. Signed-off-by: Anjaneyulu Signed-off-by: Gregory Greenman --- net/mac80211/chan.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 168bf3edd4b4..68952752b599 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -802,6 +802,11 @@ void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, } } + if (WARN_ON_ONCE(!compat)) { + rcu_read_unlock(); + return; + } + /* TDLS peers can sometimes affect the chandef width */ list_for_each_entry_rcu(sta, &local->sta_list, list) { if (!sta->uploaded || -- 2.38.1