Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3318797iob; Mon, 16 May 2022 19:14:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwguLsoWFD7rcbUr5l8LCEKSte5674AsvKT2Pbzj+0/n84SnkoVv702VTd5e1w9WnCNhDcO X-Received: by 2002:a05:6402:6d0:b0:42a:9597:9e4a with SMTP id n16-20020a05640206d000b0042a95979e4amr14094824edy.147.1652753674817; Mon, 16 May 2022 19:14:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652753674; cv=none; d=google.com; s=arc-20160816; b=JBbG3D4/0lPOfjYx2fg8l/n+2mLOjIKiLT3qUeK4rOU8Lqt1tunuO0hT6qR7BtNmGi MNkpPXXq0oRXrxMPR2ogYpBJaHOiw8RFwRjfGarb5CVI7ubDTHjYHwoLw+6PRt7aXj1P cKgGu60vwVIEQJ2+ymP91NDKQ7IfVFJ3f8JKEOvU5BoC3bQcq7tuzu0Rckkgh8rXTMZD ke54sjb0JlI/+SM3ExlsoM/JB6VmN6R+guUWQXX0BZ+9kYLT0Ry7M9P0PLjojh+SScN7 jorosyEShoql1njo1zIzU9DQH9dOlI85A1Y11i3IKxlda3mljpyyhp7F0r2EGdFsVJpS zy6Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZfZHmnRvalOket2NpBxsCLAd9CaxSUm1TZa7YyouIyM=; b=CbPJE3RYK4cEkHStKe5MhFXDKHITYpZa3JAVAkkVFKZXbm5Ki0OoMqtFKmYGus5d8g iljFVmOgt8PEkNNid8JT9/2KojomV7+m1jYKYQ1/oFfxQ1ifSpfXMpNtd+RUcZ3kNjcB MZqFn2n52/vm8/UFLZaFln8J8uxlt6qSbPj8lMa80OqGSRiIDmEV+N3fGvFd2O697fdc y6r7J2CMoGRIPO/KR8F+GmlGpGt6QYE4p/h66aBj+EmEZ8Yn6NvlD6XepXuxAuqgza91 KI8DMyHghjACDzShVknP0Q7kxzAs2bZEBZJzd8sS9FXcwfVYzUFqxLBWtGmJnNz4ovSV b7JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jeIF6155; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji11-20020a170907980b00b006e834c6948dsi1183050ejc.574.2022.05.16.19.14.09; Mon, 16 May 2022 19:14:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=jeIF6155; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244720AbiEPTrO (ORCPT + 99 others); Mon, 16 May 2022 15:47:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346083AbiEPTmu (ORCPT ); Mon, 16 May 2022 15:42:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E34853F32B; Mon, 16 May 2022 12:41:20 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 197F561512; Mon, 16 May 2022 19:41:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17105C385AA; Mon, 16 May 2022 19:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730079; bh=jXsRJZlhkkVNE5KFJ6uMHiXK5LPb7EkwA2pg9EW8UoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jeIF6155DwepFbd8POLDNrVPixbVbwQo4llPFQD0tlC3sp5+sOa+xJGgNC8PjXaRx ftF29XpFT3739QteWs+ctzPAbizNeFwVO6/Xc+Fr9hzURQSghZ1HCmxZIq1jyUnFvC jFSGmDcej8qYjzFbJggU6almYzGwDOoiAKzf62LQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Sasha Levin Subject: [PATCH 4.19 06/32] mac80211_hwsim: call ieee80211_tx_prepare_skb under RCU protection Date: Mon, 16 May 2022 21:36:20 +0200 Message-Id: <20220516193614.966264764@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193614.773450018@linuxfoundation.org> References: <20220516193614.773450018@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org From: Johannes Berg [ Upstream commit 9e2db50f1ef2238fc2f71c5de1c0418b7a5b0ea2 ] This is needed since it might use (and pass out) pointers to e.g. keys protected by RCU. Can't really happen here as the frames aren't encrypted, but we need to still adhere to the rules. Fixes: cacfddf82baf ("mac80211_hwsim: initialize ieee80211_tx_info at hw_scan_work") Signed-off-by: Johannes Berg Link: https://lore.kernel.org/r/20220505230421.5f139f9de173.I77ae111a28f7c0e9fd1ebcee7f39dbec5c606770@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- drivers/net/wireless/mac80211_hwsim.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index c84ee5ba5381..3d8e17bb8a10 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2082,11 +2082,13 @@ static void hw_scan_work(struct work_struct *work) if (req->ie_len) skb_put_data(probe, req->ie, req->ie_len); + rcu_read_lock(); if (!ieee80211_tx_prepare_skb(hwsim->hw, hwsim->hw_scan_vif, probe, hwsim->tmp_chan->band, NULL)) { + rcu_read_unlock(); kfree_skb(probe); continue; } @@ -2094,6 +2096,7 @@ static void hw_scan_work(struct work_struct *work) local_bh_disable(); mac80211_hwsim_tx_frame(hwsim->hw, probe, hwsim->tmp_chan); + rcu_read_unlock(); local_bh_enable(); } } -- 2.35.1