From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F4A23DEAD8 for ; Wed, 8 Jul 2026 19:59:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783540786; cv=none; b=R+5TAkPCGp+cNtJAcMcwgaeMG1Ai65c0OdYgYvDOEut8qmqGgccloDTnhN3G8eUE6ZKrisPqPXtZJXsVZf1z5fhSOpRSO8gUXeHzbIzF/JiKQah/MLneyeULHHk4tRN8NEuQsPGKbpJEJyDSWlSWM09Q/XpFLt0IB3eVJ612Eyo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783540786; c=relaxed/simple; bh=GJLezcDcoaMUm/tnTlPXLxiRt46ZIpeFhgWkpaquQlE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mKdaCqJejXFDmVZfGXwNGm+qBA06VWyFLP4wLiXVaDVO6Yz5ZAJ8l/8dyWi81sq44X6FGu29/CAFoT32BGOjQ05dNeLN+8zK5yelOx47ZlRnaEefLVdd7qzquRWkMivqZhXBBhAqRlUcXY2dvCUZfXr14fxBYlP15qSJjqgWiLE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FIWLw36Y; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FIWLw36Y" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-84532e3dbf7so1252239b3a.1 for ; Wed, 08 Jul 2026 12:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783540784; x=1784145584; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=W1HHhOy/pNu3cFDB2zGZwuguDV/w8raM85RkD4E2vwE=; b=FIWLw36YWIeCzP7rEklTD/FNiu9vndnFjhLkYNZ2b3oq0g2foUm05CM6pb9JwVwNXE w3Z1KieDBaROSE9XkZNj7E60lM5I/xPZShCtGrVUOIaDt4+IQvAXVVF8RHS/ZgAb0mNP U4ywhSGhxm6pjyEyIzUIObjfR6HkWWTuvKlbUNu+vhAc/cnSOTW/kwjmOPAMdFw4z0cG iVQfEEMdeSGsXmLCoycCu2jiq300gC7wSCRappI3KOd/kJ4bh3YLjkjFo3+4tZ94IRiU zAc1BQpr495BFrSL0rrPPMlrKd5hSItujATr3jv9hsHdN6x3D0T+VwLSYWpgEUad0Pxf VaZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783540784; x=1784145584; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=W1HHhOy/pNu3cFDB2zGZwuguDV/w8raM85RkD4E2vwE=; b=b3kEFftgBjQ7MrYdWu1stODWFUMqIwk7Qbf+gfE4QUyzpbwEEKk/OYXnaaP9jBPq3C ufMAyPJfKaw8szJW/nIf5Y0KBQwFrHsx3hMdO5m2Q956G9UItKeKwsZPRODQPjJEE0Ah DTxkN1czuhCqMui2VbvKmf+0veaAmCQnI4R6aFP4aU8jxtAB1iXpBJqI7eodN4G4cqw7 gaBw4duKuPIDkJ5mdLRvyaMfTTCreB18wPdZIQYk0Cq/SOrfAr5UMHhJUMkqkzkmGPVY Kby71i1xMRooov5bhFE9GVwcObq4hclvyWn1ZH/kc+8nwk1Hyp9cF5xKhmoAuKjUzYDa DGfg== X-Gm-Message-State: AOJu0YxEQhy6kCidDGae5Zeh3vA3XfWfbszT7X/YOZOvMPm4LBAZm+b8 3xuBhhKY0BUa8ylp1eM6HoYflUtEROuW6C9E9FatYXbWQXzY26krpBSt X-Gm-Gg: AfdE7cmaxIA79ZcshXatrg0M+JxrH4UiYlDDe5LOAxtL3JjEmai4KRTtAgW+//5o8Nr Ts1aHFFVAYdjesT1BJyB8wXzryXKV/rjzzphZa1ltD9ZzrfupMflPq0ZhX/IzaQuvaNiktHjv+T Yhlj7IAc/kX7W6P7EOrf3YmRWgsMCjHsrvpu5GniHxbrg9t6o83Fu7noCgw5DkYtkaThDzW7YsA yG6YCRt0z+JPCXdJKBcLwRTqRlmG1tr2qiw/fu0wikffPm/tVMuWK++Nm1Yq8GXzwsxa55o32w3 JPRBLu+YBCgWdAJXa4lN7HpCFPijLuaQGHhjUSqbFI+HSt/VMyuf8vnd7np6q+AS6SXvgXdwTjG J4fY2zAJLBdX7mDzHedp0jqihg+fIgT/UHFf7uO7qNsxrGRvsKh24IcdPyIKrGCn6ZyY5JlOUrd sLy8Fkc2eV/7KuupZnhb3J1AMEr3NTETaMcRiGPHBVChj0PZpnyWoS X-Received: by 2002:a05:6a21:4d8d:b0:3bf:6c08:fb8c with SMTP id adf61e73a8af0-3c0bd312faemr4425750637.60.1783540783226; Wed, 08 Jul 2026 12:59:43 -0700 (PDT) Received: from KRHW1CJW23.bytedance.net ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31174a8f521sm22585395eec.22.2026.07.08.12.59.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 Jul 2026 12:59:42 -0700 (PDT) From: Zhao Li To: linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Miri Korenblit , Brian Norris , Francesco Dolcini , Johannes Berg , Jaewan Kim , Daniel Gabay , Emmanuel Grumbach , Benjamin Berg , Anjaneyulu , Peddolla Harshavardhan Reddy , Lorenzo Bianconi , John Crispin , Avinash Patil , Cathy Luo , "John W. Linville" , Aloka Dixit , Zhao Li Subject: [PATCH 2/8] wifi: mac80211_hwsim: authenticate PMSR report senders Date: Thu, 9 Jul 2026 03:59:05 +0800 Message-ID: <20260708195911.84365-3-enderaoelyther@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260708195911.84365-1-enderaoelyther@gmail.com> References: <20260708195911.84365-1-enderaoelyther@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit hwsim_pmsr_report_nl() looks up the radio by HWSIM_ATTR_ADDR_TRANSMITTER and, when data->pmsr_request is set, parses the reported peer results, hands them to cfg80211_pmsr_report(), then unconditionally clears data->pmsr_request and calls cfg80211_pmsr_complete() to end the measurement. Unlike the sibling wmediumd data-path handlers hwsim_tx_info_frame_received_nl() and hwsim_cloned_frame_received_nl(), which check the sending socket's netgroup against data->netgroup and its portid against data->wmediumd, this handler did not check the sender at all, and its genl op carries no GENL_UNS_ADMIN_PERM flag. In non-virtio (wmediumd) mode any process in the netns that can reach the hwsim generic netlink family could therefore send a report. The transmitter address is not secret, so such a process could inject spoofed ranging results for another radio's in-flight request and, because the handler always completes the measurement, terminate a ranging operation owned by the real wmediumd session. Reject reports whose sender does not match the registered wmediumd instance, mirroring the sibling handlers: in non-virtio mode require the sending socket's netgroup to equal data->netgroup and info->snd_portid to equal data->wmediumd before touching the request state. Fixes: 2af3b2a631b1 ("mac80211_hwsim: add PMSR report support via virtio") Assisted-by: Codex:gpt-5 Assisted-by: Claude:opus-4.8 Signed-off-by: Zhao Li --- drivers/net/wireless/virtual/mac80211_hwsim_main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/wireless/virtual/mac80211_hwsim_main.c b/drivers/net/wireless/virtual/mac80211_hwsim_main.c index bc0818b525224..6bf9736098b67 100644 --- a/drivers/net/wireless/virtual/mac80211_hwsim_main.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim_main.c @@ -4211,6 +4211,15 @@ static int hwsim_pmsr_report_nl(struct sk_buff *msg, struct genl_info *info) if (!data) return -EINVAL; + if (!hwsim_virtio_enabled) { + if (hwsim_net_get_netgroup(genl_info_net(info)) != + data->netgroup) + return -EINVAL; + + if (info->snd_portid != data->wmediumd) + return -EPERM; + } + mutex_lock(&data->mutex); if (!data->pmsr_request) { err = -EINVAL; -- 2.50.1 (Apple Git-155)