Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp704557pxb; Tue, 5 Apr 2022 19:32:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0pDA8h+vdFBDTMo3AaXhpIylxuq8nBduFO4phJzWct6Przq+/KoquNQXFwOtsUY6OKZC/ X-Received: by 2002:a62:1407:0:b0:4fa:6d31:1056 with SMTP id 7-20020a621407000000b004fa6d311056mr6483632pfu.7.1649212373557; Tue, 05 Apr 2022 19:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649212373; cv=none; d=google.com; s=arc-20160816; b=TytTTNzEaY8g/X2dL28vGW5EmerkaMM9qCEmmnEdy5gt0lX6wKLM5NNWRIDvJc9fi3 h9prT1MqaNdxPQARtWTa+LeCjoQqWyR6S9/Now3MujD3g8jCXwUowbehDY48V+tK5C2/ WZQO/NxWQKfAYRxxCtpBQTIts8SyMd2qbkZqe3b236Lb3yntzDCErO9eI/3TWciXvnLW D5p81694Ou4TmcQgIPVfhm78QV0Asm3dyknuy7QniM0LLuB7QelYOz6Y7G3TGvkL3mBP EOsvpF9EfM4Al7lIjt9olf085G0yK1AtkvEpL5LjOvztt51W1Dvx6paI3efbr/o2b+mS 0i8Q== 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=rTBMQyH8u2Ate5QIcvaKElPl9V9k8cJ68YIST5SX11M=; b=fuKKCLOTz837Lz+ouzKrgUDS1lrBSH06ry2LDYhUqsnFBwNz5+dxAUPNoeY3iSwgTo STApEXSQElEVA3FUjrENLH96PpA+vqoMwhhTsIaaiOkRE2toWEdF0OqpYOXaAz63KhmR xy3b9u41XXPjGOTlVhNxbQ/YGEfdPdd7tnithrKSG7CON8/22QR6mtZiErD1DIMCZFxk 2TmTdGuW8XcdlamFSHYwXgcUVg0yQ1QWLEj22YgYqr/jhtxfJ61hH0RHmMcqCh7OOCZN 0YgOVwIvxzjOlgA11X1VmBO8apz+j43pJhdI4Pl4VdQhj5Yen4tcIs0wurm/Kra62yxt keJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1PRibyI1; 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 gt14-20020a17090af2ce00b001c72b4ee095si3832691pjb.11.2022.04.05.19.32.38; Tue, 05 Apr 2022 19:32:53 -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=1PRibyI1; 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 S1384821AbiDEM2H (ORCPT + 99 others); Tue, 5 Apr 2022 08:28:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245540AbiDEI4O (ORCPT ); Tue, 5 Apr 2022 04:56:14 -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 23AF812AA0; Tue, 5 Apr 2022 01:52:24 -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 A0EEF609D0; Tue, 5 Apr 2022 08:52:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD22CC385A0; Tue, 5 Apr 2022 08:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148743; bh=mzkj7bdPyPwyHELeTDKpXc4Xr4tRKHgjWC3TkZCHIe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1PRibyI14UVWIBqK2MwrhN1ojtS7jEmiKz4Cs5R5ixTxRmgggzeOU3QQdNp0/iiMW YIH9KIWfWXVVD1ykqiAE2Q6GKIxvwttEeh/kda1XYFxc28OTw5wkBaiM5Vm0Xdds+5 J5Nk+DV8/OKgBH7JAyn8F5a7X5NITb4CES5ma+Pg= 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.16 0464/1017] mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update Date: Tue, 5 Apr 2022 09:22:57 +0200 Message-Id: <20220405070408.072775283@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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.1 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: Lorenzo Bianconi [ Upstream commit 6a6f457ed5fdf6777536c20644a9e42128a50ec2 ] Check sta_rates pointer value in mt7615_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array. Fixes: 04b8e65922f63 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c index 1fdcada157d6..18a320d00d8d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -686,6 +686,9 @@ static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw, 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