* [PATCH 0/2] net: bcmasp: bug fixes for bcmasp
@ 2024-02-15 18:27 Justin Chen
2024-02-15 18:27 ` [PATCH 1/2] net: bcmasp: Indicate MAC is in charge of PHY PM Justin Chen
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Justin Chen @ 2024-02-15 18:27 UTC (permalink / raw)
To: netdev; +Cc: Justin Chen
[-- Attachment #1: Type: text/plain, Size: 589 bytes --]
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(-)
--
2.34.1
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4206 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] net: bcmasp: Indicate MAC is in charge of PHY PM
2024-02-15 18:27 [PATCH 0/2] net: bcmasp: bug fixes for bcmasp Justin Chen
@ 2024-02-15 18:27 ` Justin Chen
2024-02-15 18:27 ` [PATCH 2/2] net: bcmasp: Sanity check is off by one Justin Chen
2024-02-18 11:40 ` [PATCH 0/2] net: bcmasp: bug fixes for bcmasp patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Justin Chen @ 2024-02-15 18:27 UTC (permalink / raw)
To: netdev
Cc: Florian Fainelli, Justin Chen, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman,
open list:BROADCOM ASP 2.0 ETHERNET DRIVER, open list
[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]
From: Florian Fainelli <florian.fainelli@broadcom.com>
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.
Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet controller")
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Justin Chen <justin.chen@broadcom.com>
---
drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
index f59557b0cd51..6ad1366270f7 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp_intf.c
@@ -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)
--
2.34.1
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4206 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] net: bcmasp: Sanity check is off by one
2024-02-15 18:27 [PATCH 0/2] net: bcmasp: bug fixes for bcmasp Justin Chen
2024-02-15 18:27 ` [PATCH 1/2] net: bcmasp: Indicate MAC is in charge of PHY PM Justin Chen
@ 2024-02-15 18:27 ` Justin Chen
2024-02-15 22:10 ` Florian Fainelli
2024-02-18 11:40 ` [PATCH 0/2] net: bcmasp: bug fixes for bcmasp patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Justin Chen @ 2024-02-15 18:27 UTC (permalink / raw)
To: netdev
Cc: Justin Chen, Florian Fainelli, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Hangyu Hua,
open list:BROADCOM ASP 2.0 ETHERNET DRIVER, open list
[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]
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 <justin.chen@broadcom.com>
---
drivers/net/ethernet/broadcom/asp2/bcmasp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
index 29b04a274d07..80245c65cc90 100644
--- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c
+++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c
@@ -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;
}
--
2.34.1
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4206 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] net: bcmasp: Sanity check is off by one
2024-02-15 18:27 ` [PATCH 2/2] net: bcmasp: Sanity check is off by one Justin Chen
@ 2024-02-15 22:10 ` Florian Fainelli
0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2024-02-15 22:10 UTC (permalink / raw)
To: Justin Chen, netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman, Hangyu Hua,
open list:BROADCOM ASP 2.0 ETHERNET DRIVER, open list
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
On 2/15/24 10:27, Justin Chen wrote:
> 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 <justin.chen@broadcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] net: bcmasp: bug fixes for bcmasp
2024-02-15 18:27 [PATCH 0/2] net: bcmasp: bug fixes for bcmasp Justin Chen
2024-02-15 18:27 ` [PATCH 1/2] net: bcmasp: Indicate MAC is in charge of PHY PM Justin Chen
2024-02-15 18:27 ` [PATCH 2/2] net: bcmasp: Sanity check is off by one Justin Chen
@ 2024-02-18 11:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-18 11:40 UTC (permalink / raw)
To: Justin Chen; +Cc: netdev
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-02-18 11:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-15 18:27 [PATCH 0/2] net: bcmasp: bug fixes for bcmasp Justin Chen
2024-02-15 18:27 ` [PATCH 1/2] net: bcmasp: Indicate MAC is in charge of PHY PM Justin Chen
2024-02-15 18:27 ` [PATCH 2/2] net: bcmasp: Sanity check is off by one Justin Chen
2024-02-15 22:10 ` Florian Fainelli
2024-02-18 11:40 ` [PATCH 0/2] net: bcmasp: bug fixes for bcmasp patchwork-bot+netdevbpf
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).