Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2702291pxb; Thu, 11 Feb 2021 21:41:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdhb6uy3ZQZBC+TfgiUuNlfve2a6Wv6Y0JyqezWm9gHnsiCMcM1XVpBNJ2teyO6/jdg3na X-Received: by 2002:a17:906:b752:: with SMTP id fx18mr1405380ejb.17.1613108476938; Thu, 11 Feb 2021 21:41:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613108476; cv=none; d=google.com; s=arc-20160816; b=JTq25wpvYZbWi7+reSihL36sblnyE9kmqaT/1lgG+sXMnoqxQB3ubX2mQgDMg4S/We P0okquD9vsvF9zwlpnchxnxy/5P8G0v7TrnB1fEa0D10dCxcmZ+EKh/8yRrBS4gfXsN+ qDjjospkOghqmR5WTAFrMqnBpZPDCuUkqc9f3vWrlYZyYUXglF6bBT56xxteY1VfBMrh Y9hf6PbVw5hTUBkuZktsWSrDvXiEhlk5GkQdZDxV/FV/gCV3LJ8xtXzt6+RiI6efzIcs zMpnLYx3GqxXIt7pbOPJaz2ud8nYxeL7IPgkIKelQJR/ax6SGPcWUBWN1n3l3uSwjcgM c9+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=IrIGGg1sQ0NzZ4N2HMEewDUIFN5I3hxmFeu/bsPG8go=; b=vLM8qUMCaTIrJHb3gyjEfAnpVqDsldsHwfhv7iH0U6HRfdbDwoG7skdxBR1OsvFbhN j+lewZPW0N0sbk6T0hddmE7lb/S5nMzvZY5lP5wdZeZRMOLJetwH0HJXaIXCcDqwVwtU dgKZH+roCZPhcgOav4yTvoFnk+9qnXvgk8o/ZqFf3RO6kCGnPxTuFgkATQuJdm97gbyE QodvEVXu25L2Uj2HGzcbJ/AkI1ENot/2eDnGca9aIEtT21WAk9TBTvsOVx+47gDfuP2T W/H2BHiiSxqkvxoqul1yhDP3KHkkiRp7WLAWJ4yn58JgE436oEBkRoAtcfE900KcUzpL eO0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=hRoL8HWa; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb20si5325603ejc.183.2021.02.11.21.40.46; Thu, 11 Feb 2021 21:41:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=hRoL8HWa; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229505AbhBLFhh (ORCPT + 99 others); Fri, 12 Feb 2021 00:37:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbhBLFhh (ORCPT ); Fri, 12 Feb 2021 00:37:37 -0500 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26425C061574; Thu, 11 Feb 2021 21:36:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IrIGGg1sQ0NzZ4N2HMEewDUIFN5I3hxmFeu/bsPG8go=; b=hRoL8HWatqx5zH5SPjceLEYXES J6w7esRc5f2yF/oZQdxX7QVK+3IgqtYpRUWhd9DHQTk0mSMklrWLNXPoDtzY8RVE5U8bk6IYRLz5i hnx+WQteK7BK9N5aTYOHiMA1WqqIxt+6OZElBFNwTJ0mB+h8KqAq2sqQZpyHOPEPgmMI=; Received: from p4ff13c8d.dip0.t-ipconnect.de ([79.241.60.141] helo=nf.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1lAR8N-0003rX-I8; Fri, 12 Feb 2021 06:36:51 +0100 Subject: Re: [PATCH] mt76: hold RCU lock when calling ieee80211_find_sta_by_ifaddr() To: Shuah Khan , lorenzo.bianconi83@gmail.com, ryder.lee@mediatek.com, kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org, matthias.bgg@gmail.com Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org References: <1cfa036227cfa9fdd04316c01e1d754f13a70d9e.1613090339.git.skhan@linuxfoundation.org> <20210212021312.40486-1-skhan@linuxfoundation.org> From: Felix Fietkau Message-ID: <3949e1fc-c050-73e0-d02f-63a25c4821ef@nbd.name> Date: Fri, 12 Feb 2021 06:36:26 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210212021312.40486-1-skhan@linuxfoundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 2021-02-12 03:13, Shuah Khan wrote: > ieee80211_find_sta_by_ifaddr() must be called under the RCU lock and > the resulting pointer is only valid under RCU lock as well. > > Fix mt76_check_sta() to hold RCU read lock before it calls > ieee80211_find_sta_by_ifaddr() and release it when the resulting > pointer is no longer needed. > > This problem was found while reviewing code to debug RCU warn from > ath10k_wmi_tlv_parse_peer_stats_info() and a subsequent manual audit > of other callers of ieee80211_find_sta_by_ifaddr() that don't hold > RCU read lock. > > Signed-off-by: Shuah Khan If I'm not mistaken, this patch is unnecessary. mt76_check_sta is only called from mt76_rx_poll_complete, which itself is only called under RCU lock. - Felix