Received: by 2002:ab2:6991:0:b0:1f2:fff1:ace7 with SMTP id v17csp174139lqo; Wed, 27 Mar 2024 09:49:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWcUG9KoNSBWF8CXquWZ3TEDrhIb5CAgyhokdJ0598GxHkhset6K9p+w5kV0iiLnrLwmKLPQ/wqY0zz/0LpDjCX7gOlvo5DqEOHHqPqXg== X-Google-Smtp-Source: AGHT+IEbPlcsnunLIIpIvbP6UuOsR4d1/E7/dRoVLWh+9ozREpE92K7AG4NW47wa9HARM+UoksgF X-Received: by 2002:a05:620a:811b:b0:78a:6dc4:1215 with SMTP id os27-20020a05620a811b00b0078a6dc41215mr91828qkn.61.1711558148327; Wed, 27 Mar 2024 09:49:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711558148; cv=pass; d=google.com; s=arc-20160816; b=mrob2Txy4XXF+asaqPYmzidDwKg2uq/vX8WsqjA48NQOimcLQWN7mL/bNiCvUA9PeI Iny4z8yW1O32c+kiTqm8hJyoJMkcRMQjvFpGH+seFlRU+n6gUNG3E/7e+dF4TDJrLot9 xdkeBST2pLUb1jGVMTYeoMg0jcfQF/bNcmEpnGoddnNvvnQxKYHgb9PMWCJp3986G140 32eEJSF9/p9+0CuBhFn0TO1RZUdo3iVcXRLGYZYWtuch4ixHCGBYyQZyHvX2GmKn8j0L OS6sluOL2iX5YGUwP/0w+g8MWa4qiG8M9lPPGPaufULV1xLWeQFOovzzjUSZo2NA+53a OsCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature:dkim-filter; bh=6+JlBKkZUO4D5pelRQTg2EIVObygxMKG8QGZgAQTb4k=; fh=Z/MGJfrHwUUatUah4y6KEL6Q7Keqz72HIulgGI6IidA=; b=BbhT86l6jFkqZLTa21aWTNAamZ7UHUjv0U/lhr7chuV58yF2nn4XFvwoGjeA9XFZZR L//xlGWk1YpcX2tBB9eEGtTtNiI4GTLR9pFbwK19Xav9ouS6Wkm7b5zicvewQlnY2zVB A00VzaX0G8lLPTFVNJ0HN+JTyCzc2EWNopQrEX2+tDKKjkMF/nV1Tdubqfb1o18LZErh rgq6P3Txs6WyUSl33SGyVk5Oxf447kIHwZbfdapskxlaxD3dK47gAy4aowbaOHwyBZmT ZfiK/2afCu/o8EXOnj7zli8Ao/OkzRyR8s06oPPYk1RDP+kDGIb4hpj5iL1NEhu/i/o7 MUqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=nOgGCeYW; arc=pass (i=1 spf=pass spfdomain=candelatech.com dkim=pass dkdomain=candelatech.com dmarc=pass fromdomain=candelatech.com); spf=pass (google.com: domain of linux-wireless+bounces-5374-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5374-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y13-20020a05620a09cd00b00789fb2ecb63si10075229qky.413.2024.03.27.09.49.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 09:49:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-5374-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=nOgGCeYW; arc=pass (i=1 spf=pass spfdomain=candelatech.com dkim=pass dkdomain=candelatech.com dmarc=pass fromdomain=candelatech.com); spf=pass (google.com: domain of linux-wireless+bounces-5374-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-5374-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9BCA01C2710C for ; Wed, 27 Mar 2024 16:49:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09F70149E1F; Wed, 27 Mar 2024 16:49:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b="nOgGCeYW" X-Original-To: linux-wireless@vger.kernel.org Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F92212F583 for ; Wed, 27 Mar 2024 16:49:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.129.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711558146; cv=none; b=Ckfc91V9cmjNiea7FhXfCnixZEKfQbdcPHUoBQ+OSgBpYD6cu1TjcwSVlw/kAnWKZ+6IuaHopgwHuYdi+noqf6ZUOBIQS45fihxtQeH62PEU7Av40gc+kAVOjpQ1DkIo/HhjQckygS+lHSM1BoQzvGqGT3AjGALcir4ygKK+mpY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711558146; c=relaxed/simple; bh=tbp6KZ04r4B1c4Q0pk1lD2JPlBlcT8pOim03CLlTlzQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jlAmA/YTiNT+Aam7hrIfaGEyAF6vPHNqjeihiqJ5Pg4MywAX6zAk2naxDV9NXaGqSuNpZKx7k5/rI0O4/dvpNZYd8xG16zXo2hjguuEwR11DdEd8CtlPlu/bnez5s3B61yK6BPAgd5adFUpuMb3w7lgT5eaaBTj0uYuJiPzpelQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com; spf=pass smtp.mailfrom=candelatech.com; dkim=pass (1024-bit key) header.d=candelatech.com header.i=@candelatech.com header.b=nOgGCeYW; arc=none smtp.client-ip=148.163.129.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=candelatech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=candelatech.com X-Virus-Scanned: Proofpoint Essentials engine Received: from mail3.candelatech.com (mail2.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 4373710006B; Wed, 27 Mar 2024 16:49:03 +0000 (UTC) Received: from [192.168.100.159] (unknown [50.251.239.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail3.candelatech.com (Postfix) with ESMTPSA id E485113C2B0; Wed, 27 Mar 2024 09:49:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com E485113C2B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1711558142; bh=tbp6KZ04r4B1c4Q0pk1lD2JPlBlcT8pOim03CLlTlzQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=nOgGCeYWkHCdJmloX9UY/SFiccBZzLG0Agj7Z4941EkMnUYEMa0fkkLzAXOpeW/0K mCUJf0BokAD4gzMWEg9byoNrhPpeigj84b0QT97YaM7ZgAquZIlabOckIb3IS5KCWH Lae4QJDMY534EdffuSQohcla8Z8JfBq/+2YMJjyk= Message-ID: <2dda8ef8-b004-2afc-c398-5a3c92aa7267@candelatech.com> Date: Wed, 27 Mar 2024 09:49:01 -0700 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] wifi: mt76: mt7925: Fix invalid chandef access. Content-Language: en-US To: Lorenzo Bianconi Cc: linux-wireless@vger.kernel.org References: <20240320192723.3440938-1-greearb@candelatech.com> From: Ben Greear Organization: Candela Technologies In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-MDID: 1711558143-YeMDW48QTesw X-MDID-O: us5;ut7;1711558143;YeMDW48QTesw;;0161bc757c83381a5b931166ef547186 On 3/20/24 16:03, Lorenzo Bianconi wrote: >> From: Ben Greear >> >> mt76.ctx can be null, and that causes chandef to be null. >> Use logic found in similar code paths to use chandef >> from the phy object in case ctx is NULL. >> >> With this, my system no longer crashes, but STA will still not >> associate. > > Hi Ben, > > can you please add 'Fixes' tag to help people backporting the fix? > I think it is: > Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") I'm not able to reproduce the crash on upstream drivers, the crash only happened when I had a local patch that caused it to not associate. I still think the patch should go upstream as there may be other paths to hit the bug, but maybe it doesn't need to be backported? Let me know if you still want me to do the Fixes thing. Thanks, Ben > > Regards, > Lorenzo > >> >> Signed-off-by: Ben Greear >> --- >> drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c >> index bd37cb8d734b..feb818411a25 100644 >> --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c >> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c >> @@ -1502,7 +1502,8 @@ mt7925_mcu_sta_phy_tlv(struct sk_buff *skb, >> struct ieee80211_vif *vif, struct ieee80211_sta *sta) >> { >> struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; >> - struct cfg80211_chan_def *chandef = &mvif->mt76.ctx->def; >> + struct mt76_phy *mphy = mvif->phy->mt76; >> + struct cfg80211_chan_def *chandef = mvif->mt76.ctx ? &mvif->mt76.ctx->def : &mphy->chandef; >> struct sta_rec_phy *phy; >> struct tlv *tlv; >> u8 af = 0, mm = 0; >> @@ -1569,7 +1570,8 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, >> struct ieee80211_vif *vif, struct ieee80211_sta *sta) >> { >> struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; >> - struct cfg80211_chan_def *chandef = &mvif->mt76.ctx->def; >> + struct mt76_phy *mphy = mvif->phy->mt76; >> + struct cfg80211_chan_def *chandef = mvif->mt76.ctx ? &mvif->mt76.ctx->def : &mphy->chandef; >> enum nl80211_band band = chandef->chan->band; >> struct sta_rec_ra_info *ra_info; >> struct tlv *tlv; >> -- >> 2.42.0 >> >> -- Ben Greear Candela Technologies Inc http://www.candelatech.com