* [PATCH net-next] net: dsa: mv88e6xxx: lock mutex in port_fdb_dump
@ 2019-06-12 16:42 Vivien Didelot
2019-06-12 17:51 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Vivien Didelot @ 2019-06-12 16:42 UTC (permalink / raw)
To: netdev; +Cc: David S. Miller, andrew, f.fainelli, Vivien Didelot
During a port FDB dump operation, the mutex protecting the concurrent
access to the switch registers is currently held by the internal
mv88e6xxx_port_db_dump and mv88e6xxx_port_db_dump_fid helpers.
It must be held at the higher level in mv88e6xxx_port_fdb_dump which
is called directly by DSA through ds->ops->port_fdb_dump. Fix this.
Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 4b2f8d6f0744..6691120bd283 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -1767,9 +1767,7 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip,
eth_broadcast_addr(addr.mac);
do {
- mutex_lock(&chip->reg_lock);
err = mv88e6xxx_g1_atu_getnext(chip, fid, &addr);
- mutex_unlock(&chip->reg_lock);
if (err)
return err;
@@ -1802,10 +1800,7 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port,
int err;
/* Dump port's default Filtering Information Database (VLAN ID 0) */
- mutex_lock(&chip->reg_lock);
err = mv88e6xxx_port_get_fid(chip, port, &fid);
- mutex_unlock(&chip->reg_lock);
-
if (err)
return err;
@@ -1815,9 +1810,7 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port,
/* Dump VLANs' Filtering Information Databases */
do {
- mutex_lock(&chip->reg_lock);
err = mv88e6xxx_vtu_getnext(chip, &vlan);
- mutex_unlock(&chip->reg_lock);
if (err)
return err;
@@ -1837,8 +1830,13 @@ static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port,
dsa_fdb_dump_cb_t *cb, void *data)
{
struct mv88e6xxx_chip *chip = ds->priv;
+ int err;
- return mv88e6xxx_port_db_dump(chip, port, cb, data);
+ mutex_lock(&chip->reg_lock);
+ err = mv88e6xxx_port_db_dump(chip, port, cb, data);
+ mutex_unlock(&chip->reg_lock);
+
+ return err;
}
static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip,
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: dsa: mv88e6xxx: lock mutex in port_fdb_dump
2019-06-12 16:42 [PATCH net-next] net: dsa: mv88e6xxx: lock mutex in port_fdb_dump Vivien Didelot
@ 2019-06-12 17:51 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-06-12 17:51 UTC (permalink / raw)
To: vivien.didelot; +Cc: netdev, andrew, f.fainelli
From: Vivien Didelot <vivien.didelot@gmail.com>
Date: Wed, 12 Jun 2019 12:42:47 -0400
> During a port FDB dump operation, the mutex protecting the concurrent
> access to the switch registers is currently held by the internal
> mv88e6xxx_port_db_dump and mv88e6xxx_port_db_dump_fid helpers.
>
> It must be held at the higher level in mv88e6xxx_port_fdb_dump which
> is called directly by DSA through ds->ops->port_fdb_dump. Fix this.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-12 17:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 16:42 [PATCH net-next] net: dsa: mv88e6xxx: lock mutex in port_fdb_dump Vivien Didelot
2019-06-12 17:51 ` David Miller
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).