Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp704554pxb; Tue, 5 Apr 2022 19:32:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygTaneAs577rCvOtuVq/8ru2gM+B7Ullnx9mBf7S0ROB51sHfxaFOz32tAY5AIxDNAfV3d X-Received: by 2002:a65:5247:0:b0:382:9715:44fe with SMTP id q7-20020a655247000000b00382971544femr5290269pgp.577.1649212373516; 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=juS++vuq3zKeV103Q6q98O1yqoBq5tlUFdPmzuW8mzW1QZhe9sbHq+teqFuVTCE3ub bds7Nzk+3sg8ZmiwdVhfQ1HzkXbu2P49HRioPRy1JuS6p3xxgrTWEyF3MIUwRol5U8Yo fIsNplpePH1dzdVat9rTePDVxAttZilVS97W6lfEQfjyty9ca5T8fqs532f8fuxOBTyY 5qjp/WB+V89MRbbpbFdNilRbdBVeo1Lsk5xWNXOgCcLRZ01NGQipSLrYzVDIft4j1tpQ eoCP9m4VFFaKAiwqOmVh0QYF6o772mL8cb+kTTA3B+mu9JlvVqwtQTQBbR20WcwOekdA PWAg== 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=dItf10eifJenwZTObTIHch+VgpsWapT7ErhQKjWjsgE=; b=P6mCPHAT96LtCIWQ+E8zXh9YMF6pyEmxH5ZdMYXn7Wztcn47I2eaBfc25Umq2EPxxY 7FlukF/qWBURzjEHXCOd5meWTC2nV3LEa5LboF3I4Wd775/W9h4ZZw2+TR9s5MdvBlra d4msbwBr8mvmPviGk4g7eqXL3bWA5AACOQ47iBK6X2nMgavb4kazAxjd+pNT7OGGnnwG k12jW95L0TprOkHeZTFoDmtyRpjUr5xkhimP2LvBLfmbrakId2Vo5xNhkjx6gt2H9P8x 7uhKxOub3q6/PXvw1kz+bkBxS7++Cmva7nzxI3mbFx/pPAV5Z/AFjieOZ08SwdbpsKsd MimA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rQKvjoSb; 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 6-20020a631946000000b00398db2165basi12640406pgz.329.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=rQKvjoSb; 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 S232431AbiDEIxW (ORCPT + 99 others); Tue, 5 Apr 2022 04:53:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233523AbiDEIIA (ORCPT ); Tue, 5 Apr 2022 04:08:00 -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 BA1006AA71; Tue, 5 Apr 2022 01:02:04 -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 A7121617E8; Tue, 5 Apr 2022 08:02:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3A32C385A2; Tue, 5 Apr 2022 08:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145723; bh=9Fh6bldqlzwRXgBrOjm/tj48t5KpbZrKtorE/NBkk+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rQKvjoSbWAPBaVm+38lCcNsCN94AlXxa5/06jLd+m7oaAgbo1ato/yETa//p4HRWt MWw7eRs/aCwpASsITDvNx8JXSttgTP09LyLRWQJydaoKBPQuHYHEuBUG05Rif7znZR CGt+C+WE7en/ra61GzqV7vYAkpKeP3GXniMRwVu0= 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.17 0504/1126] mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update Date: Tue, 5 Apr 2022 09:20:51 +0200 Message-Id: <20220405070422.420801273@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@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 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 2b546bc05d82..83c5eec5b163 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/main.c @@ -641,6 +641,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