* [PATCH 1/2] net: bcmasp: Indicate MAC is in charge of PHY PM
[not found] <20240215182732.1536941-1-justin.chen@broadcom.com>
@ 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
1 sibling, 0 replies; 3+ 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 [flat|nested] 3+ messages in thread
* [PATCH 2/2] net: bcmasp: Sanity check is off by one
[not found] <20240215182732.1536941-1-justin.chen@broadcom.com>
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
1 sibling, 1 reply; 3+ 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 [flat|nested] 3+ 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; 3+ 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] 3+ messages in thread
end of thread, other threads:[~2024-02-15 22:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20240215182732.1536941-1-justin.chen@broadcom.com>
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®