lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c56c9714c754451a8255ece79353da2b@realtek.com>
Date: Thu, 6 Mar 2025 02:27:20 +0000
From: Ping-Ke Shih <pkshih@...ltek.com>
To: Shengyu Qu <wiagn233@...look.com>, "nbd@....name" <nbd@....name>,
        "lorenzo@...nel.org" <lorenzo@...nel.org>,
        "ryder.lee@...iatek.com"
	<ryder.lee@...iatek.com>,
        "shayne.chen@...iatek.com"
	<shayne.chen@...iatek.com>,
        "sean.wang@...iatek.com"
	<sean.wang@...iatek.com>,
        "johannes@...solutions.net"
	<johannes@...solutions.net>,
        "matthias.bgg@...il.com"
	<matthias.bgg@...il.com>,
        "angelogioacchino.delregno@...labora.com"
	<angelogioacchino.delregno@...labora.com>,
        "miriam.rachel.korenblit@...el.com" <miriam.rachel.korenblit@...el.com>,
        "nicolas.cavallari@...en-communications.fr"
	<nicolas.cavallari@...en-communications.fr>,
        "howard-yh.hsu@...iatek.com"
	<howard-yh.hsu@...iatek.com>,
        "greearb@...delatech.com"
	<greearb@...delatech.com>,
        "christophe.jaillet@...adoo.fr"
	<christophe.jaillet@...adoo.fr>,
        "benjamin-jw.lin@...iatek.com"
	<benjamin-jw.lin@...iatek.com>,
        "mingyen.hsieh@...iatek.com"
	<mingyen.hsieh@...iatek.com>,
        "quic_adisi@...cinc.com"
	<quic_adisi@...cinc.com>,
        "deren.wu@...iatek.com" <deren.wu@...iatek.com>,
        "chui-hao.chiu@...iatek.com" <chui-hao.chiu@...iatek.com>,
        "gustavoars@...nel.org" <gustavoars@...nel.org>,
        "bo.jiao@...iatek.com"
	<bo.jiao@...iatek.com>,
        "sujuan.chen@...iatek.com"
	<sujuan.chen@...iatek.com>,
        "linux-wireless@...r.kernel.org"
	<linux-wireless@...r.kernel.org>,
        "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>,
        "linux-mediatek@...ts.infradead.org"
	<linux-mediatek@...ts.infradead.org>
Subject: RE: [PATCH v8] wifi: mt76: mt7915: add wds support when wed is enabled

Shengyu Qu <wiagn233@...look.com> wrote:

[...]

> @@ -1271,6 +1278,10 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
>  {
>         struct mt7915_dev *dev = mt7915_hw_dev(hw);
>         struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
> +       int min = MT76_WED_WDS_MIN, max = MT76_WED_WDS_MAX;
> +       struct ieee80211_sta *pre_sta;
> +       u8 flags = MT76_WED_DEFAULT;
> +       int temp_idx;

In general 'temp' is short for temperature. 'tmp' is preferred.

> 
>         if (enabled)
>                 set_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags);
> @@ -1280,6 +1291,30 @@ static void mt7915_sta_set_4addr(struct ieee80211_hw *hw,
>         if (!msta->wcid.sta)
>                 return;
> 
> +       if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
> +           !is_mt7915(&dev->mt76) &&
> +           (msta->wcid.idx < min || msta->wcid.idx > max - 1)) {
> +               pre_sta = kzalloc(sizeof(*sta) + sizeof(*msta), GFP_KERNEL);
> +               memmove(pre_sta, sta, sizeof(*sta) + sizeof(*msta));

Seemingly, kmemdup() = kzalloc() + memmove().

> +
> +               flags = test_bit(MT_WCID_FLAG_4ADDR, &msta->wcid.flags) ?
> +                       MT76_WED_WDS_ACTIVE : MT76_WED_ACTIVE;
> +
> +               temp_idx = __mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA, flags);

Since __mt76_wcid_alloc() could return -1 for error case, shouldn't you handle that?

> +               ((struct mt7915_sta *)pre_sta->drv_priv)->wcid.idx = (u16)temp_idx;

Define a local `struct mt7915_sta *pre_msta = (struct mt7915_sta *)pre_sta->drv_priv`
ahead. This statement would be simpler. Just `pre_msta-> wcid.idx = (u16)temp_idx`,
but casting of '(u16)' is still not very preferred.

> +               mt7915_mac_sta_add(&dev->mt76, vif, pre_sta);
> +               rcu_assign_pointer(dev->mt76.wcid[temp_idx], &msta->wcid);
> +
> +               temp_idx = msta->wcid.idx;
> +               msta->wcid.idx = ((struct mt7915_sta *)pre_sta->drv_priv)->wcid.idx;
> +               ((struct mt7915_sta *)pre_sta->drv_priv)->wcid.idx = (u16)temp_idx;
> +               rcu_assign_pointer(dev->mt76.wcid[temp_idx], NULL);
> +
> +               synchronize_rcu();
> +               mt7915_mac_sta_remove(&dev->mt76, vif, pre_sta);
> +               kfree(pre_sta);
> +       }
> +
>         mt76_connac_mcu_wtbl_update_hdr_trans(&dev->mt76, vif, sta);
>  }
> 

[...]


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ