swphy_read_reg is called quite frequently during normal operation. If an
invalid speed is used for state, then it can turn dmesg into a firehose.
Although the first warn will likely contain a backtrace for the
offending driver, later warnings will usually just contain a backtrace
from the phy state machine. Just warn once.
Signed-off-by: Sean Anderson <[email protected]>
---
drivers/net/phy/swphy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/swphy.c b/drivers/net/phy/swphy.c
index 59f1ba4d49bc..9af155a25f23 100644
--- a/drivers/net/phy/swphy.c
+++ b/drivers/net/phy/swphy.c
@@ -124,7 +124,7 @@ int swphy_read_reg(int reg, const struct fixed_phy_status *state)
return -1;
speed_index = swphy_decode_speed(state->speed);
- if (WARN_ON(speed_index < 0))
+ if (WARN_ON_ONCE(speed_index < 0))
return 0;
duplex_index = state->duplex ? SWMII_DUPLEX_FULL : SWMII_DUPLEX_HALF;
--
2.35.1.1320.gc452695387.dirty
On Thu, Dec 01, 2022 at 03:22:53PM -0500, Sean Anderson wrote:
> swphy_read_reg is called quite frequently during normal operation. If an
> invalid speed is used for state, then it can turn dmesg into a firehose.
> Although the first warn will likely contain a backtrace for the
> offending driver, later warnings will usually just contain a backtrace
> from the phy state machine. Just warn once.
Hi Sean
How did you trigger this? I have a patch in this area as well, which i
want Russells opinion on. I'm wondering if we are hitting the same
problem.
Andrew