From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03D98C43217 for ; Wed, 23 Feb 2022 02:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236806AbiBWC27 (ORCPT ); Tue, 22 Feb 2022 21:28:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236777AbiBWC24 (ORCPT ); Tue, 22 Feb 2022 21:28:56 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F77C3DDC3; Tue, 22 Feb 2022 18:28:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 56474B81E0C; Wed, 23 Feb 2022 02:28:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 007C7C340F0; Wed, 23 Feb 2022 02:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645583306; bh=dD7/c67Sva+hXnDYcYC8UKHl8uZid1Fjht+X0oqVgiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iygdDWSNrsEIdmxYiWKLoMWZ22EK910KQB37P84NCulsPXGW+0USIQj8AuS/V3HF2 uckHaVM5uQ1kNHqkbsmrjbhdLMr5FaCoKiTdZVtk1V2sKqgtv5YuRC0FTiGqyL6Q/Q oqpXkwPIKK/0ZNJr/+MkrrMRi0e3PXXo+DApbUb9KalKzn28o22+nbbnbkv7+nfNEc 3QzrPB1pz96sOcT3bcMS4+p0hPdetNDzR3SVDx+FPIEF2KX7v4jJU2Pvya81yrDfLS zmAQZUEgsunotctXL4V2z/FCD9KDs/5FvaPAX2b3aOO8WtCc1Tq0nk6xfNKmqBZYQ2 7zZUQB5pNHg+w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: JaeMan Park , Johannes Berg , Sasha Levin , johannes@sipsolutions.net, kvalo@kernel.org, davem@davemloft.net, kuba@kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 03/30] mac80211_hwsim: initialize ieee80211_tx_info at hw_scan_work Date: Tue, 22 Feb 2022 21:27:52 -0500 Message-Id: <20220223022820.240649-3-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220223022820.240649-1-sashal@kernel.org> References: <20220223022820.240649-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: JaeMan Park [ Upstream commit cacfddf82baf1470e5741edeecb187260868f195 ] In mac80211_hwsim, the probe_req frame is created and sent while scanning. It is sent with ieee80211_tx_info which is not initialized. Uninitialized ieee80211_tx_info can cause problems when using mac80211_hwsim with wmediumd. wmediumd checks the tx_rates field of ieee80211_tx_info and doesn't relay probe_req frame to other clients even if it is a broadcasting message. Call ieee80211_tx_prepare_skb() to initialize ieee80211_tx_info for the probe_req that is created by hw_scan_work in mac80211_hwsim. Signed-off-by: JaeMan Park Link: https://lore.kernel.org/r/20220113060235.546107-1-jaeman@google.com [fix memory leak] Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/mac80211_hwsim.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 20fae2df848fb..f7cfda9192de2 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2336,6 +2336,15 @@ static void hw_scan_work(struct work_struct *work) if (req->ie_len) skb_put_data(probe, req->ie, req->ie_len); + if (!ieee80211_tx_prepare_skb(hwsim->hw, + hwsim->hw_scan_vif, + probe, + hwsim->tmp_chan->band, + NULL)) { + kfree_skb(probe); + continue; + } + local_bh_disable(); mac80211_hwsim_tx_frame(hwsim->hw, probe, hwsim->tmp_chan); -- 2.34.1