From patchwork Sun Sep 1 16:31:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1979405 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=t53itm/j; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=BIZlLfJN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WxcyF6xLsz1ygF for ; Mon, 2 Sep 2024 02:38:13 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=/h/A8lECA3YFwmvraMNQZCmr7LBkXq5Q6IWqzzMg0nE=; b=t53itm/j2yhlLD 8PAQ7pq2xNTG8/z4iHB0uhGqczJvZNOK2TK4kCm9KMmaYxJA+tWb89nz6O1qqlIL+0cXQYL3iuBQL p7hU0RSESN/UeHGXsEQ8mUaVPTz4U/3rx0wpOtv6f9bhouzpnQnmkErbpDwa/q19WTPAeSdQWO69s 8MfeAevyoDZ1NBkGC2qk1YaxQ5EaHmSkjj++D6B81ZXB1hPnwwgCrR23qpwgEw2pCdDnNxB3/Bm08 H6VCgaI5hJ69iBer/SKIZB8Fsz73BVQuJ1Yk7Zr307JboM+l95B8kxQcmssRxoBkM7oDxS3MouL+c 7If9qy0h9toczchF280Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1skna3-0000000BxyE-1SrK; Sun, 01 Sep 2024 16:37:35 +0000 Received: from mgamail.intel.com ([192.198.163.10]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sknZz-0000000Bxw4-38Jc for hostap@lists.infradead.org; Sun, 01 Sep 2024 16:37:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725208652; x=1756744652; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=vbyLeKtpOWD1gJnH2DBUDntDZO4Xthk2pDA93WSOEp4=; b=BIZlLfJN5iaNX34T3h4m6l2d1MBOl05F9fJCQSxrEXFRH4/dyDSLdRxU Gpjr2Nk4jUCkP7EG8Yf0R7h5rm6/HLQF9pl2cp1QsCPmD8xnLU4HAcSpB y372eag/eW+pDnqB+KZGCBtp22md3FRiWzNrMYrc5qN+3fj/eDqCoa1DI VtRYy9pp7YIyCwF9/dqXOvP54+jV7Ib8LRqhfPvwa++EoaYErAHbb7Ram FLKoVbrQeaoVlG6wJLoXUayac9hvXLk6V3E0YKMkwRFdlulVw+qLxvhZG xKTLHj2n4TFCA04kpUDsT8ohvQk+srJCiXYX7xJvcmu0LEBLmtBsWkYAG A==; X-CSE-ConnectionGUID: AHWGdA58SrCJjPPUtSZTPw== X-CSE-MsgGUID: eDYbD31nQ56+DOHJUUbSjQ== X-IronPort-AV: E=McAfee;i="6700,10204,11182"; a="35193454" X-IronPort-AV: E=Sophos;i="6.10,194,1719903600"; d="scan'208";a="35193454" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2024 09:37:31 -0700 X-CSE-ConnectionGUID: Gi5J+0OLTeCRZzw2V80xog== X-CSE-MsgGUID: 7s7h8OReQmWF9H07WsxJ4g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,194,1719903600"; d="scan'208";a="101844837" Received: from weis0042.iil.intel.com ([10.12.217.211]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Sep 2024 09:37:29 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Andrei Otcheretianski Subject: [PATCH] AP: Fix a crash in hostapd_driver_init() Date: Sun, 1 Sep 2024 19:31:35 +0300 Message-ID: <20240901163135.2141665-3-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240901_093731_826666_03D70519 X-CRM114-Status: GOOD ( 13.47 ) X-Spam-Score: -4.5 (----) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In case of MLD AP it is assumed that the multi link information (hapd->mld) is already initialized by the time this function is called. However, if the interface is added without bss_config parameter, [...] Content analysis details: (-4.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [192.198.163.10 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [192.198.163.10 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [192.198.163.10 listed in sa-trusted.bondedsender.org] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.198.163.10 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. -0.1 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In case of MLD AP it is assumed that the multi link information (hapd->mld) is already initialized by the time this function is called. However, if the interface is added without bss_config parameter, hostapd_bss_setup_multi_link() would bail out immediately as mld_ap parameter isn't set yet. When the interface gets enabled later, hapd->mld would be NULL resulting in NULL dereference. Signed-off-by: Andrei Otcheretianski --- hostapd/main.c | 5 ++++- src/ap/hostapd.c | 4 ++-- src/ap/hostapd.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hostapd/main.c b/hostapd/main.c index 512cd892bd..72bf324448 100644 --- a/hostapd/main.c +++ b/hostapd/main.c @@ -168,8 +168,11 @@ static int hostapd_driver_init(struct hostapd_iface *iface) } #ifdef CONFIG_IEEE80211BE - if (conf->mld_ap) + if (conf->mld_ap) { + if (!hapd->mld) + hostapd_bss_setup_multi_link(hapd, iface->interfaces); h_hapd = hostapd_mld_get_first_bss(hapd); + } if (h_hapd) { hapd->drv_priv = h_hapd->drv_priv; diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index f97311587d..23bff4ffa6 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -3080,8 +3080,8 @@ static void hostapd_bss_alloc_link_id(struct hostapd_data *hapd) #endif /* CONFIG_IEEE80211BE */ -static void hostapd_bss_setup_multi_link(struct hostapd_data *hapd, - struct hapd_interfaces *interfaces) +void hostapd_bss_setup_multi_link(struct hostapd_data *hapd, + struct hapd_interfaces *interfaces) { #ifdef CONFIG_IEEE80211BE struct hostapd_mld *mld, **all_mld; diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index dddefb593c..dabca24efc 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -766,6 +766,8 @@ struct hostapd_iface * hostapd_init(struct hapd_interfaces *interfaces, struct hostapd_iface * hostapd_interface_init_bss(struct hapd_interfaces *interfaces, const char *phy, const char *config_fname, int debug); +void hostapd_bss_setup_multi_link(struct hostapd_data *hapd, + struct hapd_interfaces *interfaces); void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, int reassoc); void hostapd_interface_deinit_free(struct hostapd_iface *iface);