From: Vivien Didelot <hidden> Date: 2015-08-03 13:18:01
At switch setup, _mv88e6xxx_stats_wait was called without holding the
SMI mutex. Fix this by requesting the lock for this call.
Also, return the _mv88e6xxx_stats_wait code, since it may fail.
Signed-off-by: Vivien Didelot <redacted>
---
drivers/net/dsa/mv88e6xxx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
@@ -1938,6 +1938,7 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds)intmv88e6xxx_setup_global(structdsa_switch*ds){structmv88e6xxx_priv_state*ps=ds_to_priv(ds);+intret;inti;/* Set the default address aging time to 5 minutes, and
@@ -2036,9 +2037,11 @@ int mv88e6xxx_setup_global(struct dsa_switch *ds)REG_WRITE(REG_GLOBAL,GLOBAL_STATS_OP,GLOBAL_STATS_OP_FLUSH_ALL);/* Wait for the flush to complete. */-_mv88e6xxx_stats_wait(ds);+mutex_lock(&ps->smi_mutex);+ret=_mv88e6xxx_stats_wait(ds);+mutex_unlock(&ps->smi_mutex);-return0;+returnret;}intmv88e6xxx_switch_reset(structdsa_switch*ds,boolppu_active)
At switch setup, _mv88e6xxx_stats_wait was called without holding the
SMI mutex. Fix this by requesting the lock for this call.
Also, return the _mv88e6xxx_stats_wait code, since it may fail.
Signed-off-by: Vivien Didelot <redacted>
Not strictly needed because the mutex is initialized in the same call
sequence, but it doesn't hurt and is technically ok (and may prevent others
from submitting the same patch again ;-)
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
@@ -1938,6 +1938,7 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds)intmv88e6xxx_setup_global(structdsa_switch*ds){structmv88e6xxx_priv_state*ps=ds_to_priv(ds);+intret;inti;/* Set the default address aging time to 5 minutes, and
@@ -2036,9 +2037,11 @@ int mv88e6xxx_setup_global(struct dsa_switch *ds)REG_WRITE(REG_GLOBAL,GLOBAL_STATS_OP,GLOBAL_STATS_OP_FLUSH_ALL);/* Wait for the flush to complete. */-_mv88e6xxx_stats_wait(ds);+mutex_lock(&ps->smi_mutex);+ret=_mv88e6xxx_stats_wait(ds);+mutex_unlock(&ps->smi_mutex);-return0;+returnret;}intmv88e6xxx_switch_reset(structdsa_switch*ds,boolppu_active)
From: David Miller <davem@davemloft.net> Date: 2015-08-03 22:46:37
From: Vivien Didelot <redacted>
Date: Mon, 3 Aug 2015 09:17:44 -0400
At switch setup, _mv88e6xxx_stats_wait was called without holding the
SMI mutex. Fix this by requesting the lock for this call.
Also, return the _mv88e6xxx_stats_wait code, since it may fail.
Signed-off-by: Vivien Didelot <redacted>