Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2129720iof; Tue, 7 Jun 2022 20:44:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbAFdIqVWEJxG9bT3Puzjm/iQ/LdmL8QTsk1IFNvlgMOOj0Hy/LcOcE+jAiTJ+LXqLcBsF X-Received: by 2002:a17:902:d34b:b0:163:eae3:c972 with SMTP id l11-20020a170902d34b00b00163eae3c972mr32209967plk.78.1654659850270; Tue, 07 Jun 2022 20:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654659850; cv=none; d=google.com; s=arc-20160816; b=nuidKEyXINp4lP1g86BjYObwN/qV21PnayrM0zTOQphZM7hdz5XrXfGKUS03I5j4Vj Jgpip0ScRouAduFHAB1RV2jkWwUXkHMsITx82R7qi0+/AR+39TQ2DYxBWvSykV/Qx4EG HucEgDH7M58EFxuge2S/0RYHTJfHMP5t0w7v9ebZILWe7peEIk99aCflg6mu8gDEXhz7 SpZGom92IwZhQYgf4KQviDvPuPATwcKoWqsSQfQfTDy2CBAKqOmjGPHljTJrp3IipPW3 ZEo2JHn7JaCgDGOAVi/C7QRMTehphLI96GeLKVPnX1opoZCMbF1oTj17qjdU0pewRFBK k1Fg== 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=cVFjdIRYPQaieySUZk6q3Dg/jU60lPvQGXnwqVXIlbI=; b=naDiO6ytPiPXspH5yaYSEL6bLr7KTga6/SDhGHO+qcEYNQkuvr7+uPpW9eVoe9piyb utR2PXvdgjNm4kV0Q6jy+HgmbP0TAKCmP18lWLgTgjEjHhYcMcQNvNaEuJL5HasonfJw tKWiH4+IRlUB2yU48I4E/qpAKyQeWNRURBfRDNMk4uZRglvxi8Sqn9h9TKfRdDOZWV2R CH6CLPnNmb5rVyUh3sTpsjUurlbCYtLcVbhDTLYThZz97z7vkEVAjQjkz6FYsmvFCA9X /TjA9ms8dPtNg64vzbyLMO89LQijsBOAy1I9UabVDUdTXjvf9JEAuf6UQVWsYi++2Zq+ ZrLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Qrr/eLju"; 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 b12-20020a17090a800c00b001c6d5497bb9si27272688pjn.28.2022.06.07.20.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:44:10 -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="Qrr/eLju"; 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 701FC2E0F2A; Tue, 7 Jun 2022 20:03:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385968AbiFGWrg (ORCPT + 99 others); Tue, 7 Jun 2022 18:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380703AbiFGVib (ORCPT ); Tue, 7 Jun 2022 17:38:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97F0717A8A2; Tue, 7 Jun 2022 12:05:31 -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 ams.source.kernel.org (Postfix) with ESMTPS id D9BB9B82182; Tue, 7 Jun 2022 19:05:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 357D8C385A2; Tue, 7 Jun 2022 19:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628728; bh=wcn8OR6hwXLb9GrRak3DYFeomYb3hzti77qpfWCvew4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qrr/eLjuJlQqHzsuO/tTmN2d744V0gMYHplg6i/rlHuLXmSSd6qXjL3x7LZoK0gOy +0dKRhpNWMYS6pay8T7WEzCTFw5qbH4xmsykECMDp9eTApdl8uZrw3QN2sWJWsbEJt NRBau/03iuv0jx/ugglHFzm5HVsiN5Pzc7R5Y5GA= 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.18 434/879] mt76: mt7915: fix possible NULL pointer dereference in mt7915_mac_fill_rx_vector Date: Tue, 7 Jun 2022 18:59:12 +0200 Message-Id: <20220607165015.467789454@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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=-3.1 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=unavailable 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 62fdc974894eec80d678523458cf99bbdb887e22 ] Fix possible NULL pointer dereference in mt7915_mac_fill_rx_vector routine if the chip does not support dbdc and the hw reports band_idx set to 1. Fixes: 78fc30a21cf11 ("mt76: mt7915: move testmode data from dev to phy") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index eaa31f5e0b00..fe2b63cf61d8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -864,8 +864,11 @@ mt7915_mac_fill_rx_vector(struct mt7915_dev *dev, struct sk_buff *skb) int i; band_idx = le32_get_bits(rxv_hdr[1], MT_RXV_HDR_BAND_IDX); - if (band_idx && !phy->band_idx) + if (band_idx && !phy->band_idx) { phy = mt7915_ext_phy(dev); + if (!phy) + goto out; + } rcpi = le32_to_cpu(rxv[6]); ib_rssi = le32_to_cpu(rxv[7]); @@ -890,8 +893,8 @@ mt7915_mac_fill_rx_vector(struct mt7915_dev *dev, struct sk_buff *skb) phy->test.last_freq_offset = foe; phy->test.last_snr = snr; +out: #endif - dev_kfree_skb(skb); } -- 2.35.1