net: bcmasp: bug fixes for bcmasp
Subsystems (3)
Justin Chen
maintainercover net: bcmasp: bug fixes for bcmasp
Fix two bugs.
- Indicate that PM is managed by mac to prevent double pm calls. This doesn't lead to a crash, but waste a noticable amount of time suspending/resuming.
- Sanity check for OOB write was off by one. Leading to a false error when using the full array.
Florian Fainelli (1):
net: bcmasp: Indicate MAC is in charge of PHY PM
Justin Chen (1):
net: bcmasp: Sanity check is off by one
drivers/net/ethernet/broadcom/asp2/bcmasp.c | 6 +++--- drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1
Justin Chen
maintainerPATCH 1/2 net: bcmasp: Indicate MAC is in charge of PHY PM
From: Florian Fainelli <[email protected]>
Avoid the PHY library call unnecessarily into the suspend/resume functions by setting phydev->mac_managed_pm to true. The ASP driver essentially does exactly what mdio_bus_phy_resume() does.
--- drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c +3 -0
@@ -1050,6 +1050,9 @@ static int bcmasp_netif_init(struct net_device *dev, bool phy_connect)netdev_err (dev,"could not attach to PHY\n" ); goto err_phy_disable; } + +/* Indicate that the MAC is responsible for PHY PM */ + phydev->mac_managed_pm = true; }else if (!intf->wolopts) { ret =phy_resume (dev->phydev);if (ret)
Signature · 1 line
2.34.1
Justin Chen
maintainerPATCH 2/2 net: bcmasp: Sanity check is off by one
In reply to Justin ChenA sanity check for OOB write is off by one leading to a false positive when the array is full.
--- drivers/net/ethernet/broadcom/asp2/bcmasp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/asp2/bcmasp.c +3 -3
@@ -535,9 +535,6 @@ int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,int j =0 , i;for (i =0 ; i <NUM_NET_FILTERS ; i++) { -if (j == *rule_cnt) -return -EMSGSIZE ; -if (!priv->net_filters[i].claimed || priv->net_filters[i].port != intf->port)continue ;
@@ -547,6 +544,9 @@ int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs, priv->net_filters[i - 1].wake_filter)continue ; +if (j == *rule_cnt) +return -EMSGSIZE ; + rule_locs[j++] = priv->net_filters[i].fs.location; }
Signature · 1 line
2.34.1
Re: [PATCH 2/2] net: bcmasp: Sanity check is off by one
Quoted 5 lines · Justin Chen
A sanity check for OOB write is off by one leading to a false positive when the array is full.
Fixes 9b90aca97f6d ("net: ethernet: bcmasp: fix possible OOB write in bcmasp_netfilt_get_all_active()")Signed-off-by Justin Chen <[email protected]>
Signature · 1 line
Florian
This series was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 10 lines · On Thu, 15 Feb 2024 10:27:30 -0800 you wrote:
Fix two bugs.
- Indicate that PM is managed by mac to prevent double pm calls. This doesn't lead to a crash, but waste a noticable amount of time suspending/resuming.
- Sanity check for OOB write was off by one. Leading to a false error when using the full array.
[...]
Here is the summary with links:
- [1/2] net: bcmasp: Indicate MAC is in charge of PHY PM
https://git.kernel.org/netdev/net/c/5b76d928f8b7 - [2/2] net: bcmasp: Sanity check is off by one https://git.kernel.org/netdev/net/c/f120e62e37f0
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html