Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp916936pxb; Wed, 6 Apr 2022 04:12:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQhDveZA4W2jayfO2DLsMiBfXgYIeape0nTcF69OGWOiwNofIX6eW+/cZ/lHxlfFLEUGbJ X-Received: by 2002:a17:90a:aa98:b0:1b8:5adb:e35f with SMTP id l24-20020a17090aaa9800b001b85adbe35fmr9354840pjq.192.1649243562504; Wed, 06 Apr 2022 04:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649243562; cv=none; d=google.com; s=arc-20160816; b=C3/9KPsz0rDBRxHkWQHSwXsZNOpTMtPvK5gxz8ZFyYaBlZ+bul72TdlrmDRKBBq9X0 xLkfcFcKZTPnWiQQ/geUXAW6UY5aVPVLY8DnzyBGQS1+Xp/4kygY+qvAArygJvLDLoEh +NExojRcoXWiRCj/wxLaJKHZmQTDRLkR4u8sFaaGcayhyKG/5XwCW7kGC53EuXmlDatF 8lNFb29weN3qEDQLAWfnoy5szV9qydC9A1ZrjS2L7pU5OIO5hiUoC49V9aaWZ8FMaDeA jxwEiqPQXizHgJrFR0xPWblrfk9QW+NH+8fFEjH4BrWd1wgshciq/LFR6hx69n0Di8RA f66g== 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=Rw5BU6pXLW/0aGiHKfRwbsP/SrHe3qXzPd/mTvZ6+Vo=; b=erw7Q+HHiChKepzISJKiFUuL5Ze+ywiDc8anfDrtpuMptFgEppyV7UlrKn8u6NJc4o dvsmfDlKeRGgZGl0FNaIHOEM0U3dh62rVRiK0/kZ1Nk9m6ZF+zX0Cy4j8StwfIO5u8lk lCwwTBLbsgYjdGBahMKY/6CnXsK6B24emNpDAxNF2mnxGkM36jslsYOpxxcqKS3c/a94 sXMpxkUlW3X1C0pfATkwUdxIpvPgij2kf7FHQuTLfcrkWthQISR7eXx4PqI+CVWPd/Dd +ZEU88LvQwM7iEyp0gZAB4NF+hKvX4ianhwXcKhitbDXZBIKex6qkizpin5hATAuM9LH FiyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KlokxfHq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m14-20020a637d4e000000b003816043ef93si15102944pgn.392.2022.04.06.04.12.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:12:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KlokxfHq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 789814DC58B; Wed, 6 Apr 2022 02:38:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1584563AbiDEX6h (ORCPT + 99 others); Tue, 5 Apr 2022 19:58:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348928AbiDEJss (ORCPT ); Tue, 5 Apr 2022 05:48:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E560A56F4; Tue, 5 Apr 2022 02:37:47 -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 04CCA6165C; Tue, 5 Apr 2022 09:37:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E6B8C385A3; Tue, 5 Apr 2022 09:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151466; bh=uBuV62BtYciTZrMO2noRUgAD1WBIacHcGFtWbkEcHBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlokxfHqBbMvJfyuorqb206I5PT2yHsD2jR7362xk1Hb1xU/wFCE1HRojCS/oIbUN rXH+QDziWn8q3mRemUem8edrpUORmgaX4c7FBFyltj6jABZYspDaBwmz497lyMVGQU N71LPAW27XoQ5dFpoWFo0NxS72HTWS59zCgKsmbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.15 426/913] mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update Date: Tue, 5 Apr 2022 09:24:48 +0200 Message-Id: <20220405070352.613921988@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Lorenzo Bianconi [ Upstream commit fc8e2c707ce11c8ec2e992885b0d53a5e04031ac ] Check sta_rates pointer value in mt7603_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array. Fixes: c8846e1015022 ("mt76: add driver for MT7603E and MT7628/7688") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7603/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/main.c b/drivers/net/wireless/mediatek/mt76/mt7603/main.c index 8edea1e7a602..7f52a4a11cea 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c @@ -620,6 +620,9 @@ mt7603_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta_rates *sta_rates = rcu_dereference(sta->rates); int i; + if (!sta_rates) + return; + spin_lock_bh(&dev->mt76.lock); for (i = 0; i < ARRAY_SIZE(msta->rates); i++) { msta->rates[i].idx = sta_rates->rate[i].idx; -- 2.34.1