linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Gax-c <zichenxie0106@gmail.com>,
	nbd@nbd.name, lorenzo@kernel.org, ryder.lee@mediatek.com,
	shayne.chen@mediatek.com, sean.wang@mediatek.com,
	kvalo@kernel.org, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com, johannes.berg@intel.com,
	quic_adisi@quicinc.com, deren.wu@mediatek.com,
	chui-hao.chiu@mediatek.com, meichia.chiu@mediatek.com,
	mingyen.hsieh@mediatek.com, howard-yh.hsu@mediatek.com,
	StanleyYP.Wang@mediatek.com, allen.ye@mediatek.com,
	benjamin-jw.lin@mediatek.com, Bo.Jiao@mediatek.com,
	Money.Wang@mediatek.com
Cc: linux-wireless@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Zijie Zhao <zzjas98@gmail.com>,
	Chenyuan Yang <chenyuan0y@gmail.com>
Subject: Re: [PATCH] wifi: mt76: Fix NULL Pointer Dereference caused by mt76_connac_get_he_phy_cap()
Date: Tue, 1 Oct 2024 21:46:42 +0200	[thread overview]
Message-ID: <3e40513c-3c58-4d25-8dc7-1d9bfc38fcf5@kernel.org> (raw)
In-Reply-To: <20240930212014.30607-1-zichenxie0106@gmail.com>

On 30/09/2024 23:20, Gax-c wrote:
> like commit f503ae90c735 ("wifi: mt76: mt7996: fix NULL pointer dereference in mt7996_mcu_sta_bfer_he"), mt76_connac_get_he_phy_cap() may return a NULL pointer, leading to NULL Pointer Dereference.
> Add a null check for the returned pointer.
> 
> Fixes: a5c372f77aa7 ("wifi: mt76: mt7925: extend mt7925_mcu_bss_he_tlv for per-link BSS")
> Fixes: e6d557a78b60 ("mt76: mt7915: rely on mt76_connac_get_phy utilities")
> Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
> Signed-off-by: Zichen Xie <zichenxie0106@gmail.com>
> Reported-by: Zichen Xie <zichenxie0106@gmail.com>
> Reported-by: Zijie Zhao <zzjas98@gmail.com>
> Reported-by: Chenyuan Yang <chenyuan0y@gmail.com>

Same comments as in other patches.

> ---
>  drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 6 ++++++
>  drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 3 +++
>  drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 +++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> index 87d0dd040001..941a6e40e94c 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> @@ -552,6 +552,9 @@ mt7915_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
>  
>  	cap = mt76_connac_get_he_phy_cap(phy->mt76, vif);
>  

Same problem as in other patches - drop unnecessary blank line.

> +	if (!cap)
> +		return;
> +
>  	tlv = mt76_connac_mcu_add_tlv(skb, BSS_INFO_HE_BASIC, sizeof(*he));
>  
>  	he = (struct bss_info_he *)tlv;
> @@ -1145,6 +1148,9 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
>  	u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map);
>  	u8 snd_dim, sts;
>  
> +	if (!vc)
> +		return;
> +
>  	bf->tx_mode = MT_PHY_TYPE_HE_SU;
>  
>  	mt7915_mcu_sta_sounding_rate(bf);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> index 748ea6adbc6b..1caf3e3e0e87 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
> @@ -2509,6 +2509,9 @@ mt7925_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf,
>  
>  	cap = mt76_connac_get_he_phy_cap(phy->mt76, link_conf->vif);
>  
> +	if (!cap)
> +		return;
> +
>  	tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_HE_BASIC, sizeof(*he));
>  
>  	he = (struct bss_info_uni_he *)tlv;
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> index 6c445a9dbc03..e547729701b7 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c
> @@ -799,6 +799,9 @@ mt7996_mcu_bss_he_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,
>  
>  	cap = mt76_connac_get_he_phy_cap(phy->mt76, vif);
>  
> +	if (!cap)
> +		return;

Don't you need to handle the error? Cleanup?


Best regards,
Krzysztof



      reply	other threads:[~2024-10-01 19:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-30 21:20 [PATCH] wifi: mt76: Fix NULL Pointer Dereference caused by mt76_connac_get_he_phy_cap() Gax-c
2024-10-01 19:46 ` Krzysztof Kozlowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3e40513c-3c58-4d25-8dc7-1d9bfc38fcf5@kernel.org \
    --to=krzk@kernel.org \
    --cc=Bo.Jiao@mediatek.com \
    --cc=Money.Wang@mediatek.com \
    --cc=StanleyYP.Wang@mediatek.com \
    --cc=allen.ye@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=benjamin-jw.lin@mediatek.com \
    --cc=chenyuan0y@gmail.com \
    --cc=chui-hao.chiu@mediatek.com \
    --cc=deren.wu@mediatek.com \
    --cc=howard-yh.hsu@mediatek.com \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=meichia.chiu@mediatek.com \
    --cc=mingyen.hsieh@mediatek.com \
    --cc=nbd@nbd.name \
    --cc=quic_adisi@quicinc.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    --cc=zichenxie0106@gmail.com \
    --cc=zzjas98@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).