summary refs log tree commit diff
path: root/drivers/net
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2023-07-24 05:25:30 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-03 10:24:15 +0200
commit828f9526f0611c589c404826d9d96fe4d7e8ebfe (patch)
tree56eaa4c207ab8722d6081b1e763c6d9f9f6b6bbe /drivers/net
parentd42c326288ac2f20eb1b6f1a1008433e061a84c8 (diff)
downloadlinux-828f9526f0611c589c404826d9d96fe4d7e8ebfe.tar.gz
net: dsa: qca8k: fix broken search_and_del
commit ae70dcb9d9ecaf7d9836d3e1b5bef654d7ef5680 upstream.

On deleting an MDB entry for a port, fdb_search_and_del is used.
An FDB entry can't be modified so it needs to be deleted and readded
again with the new portmap (and the port deleted as requested)

We use the SEARCH operator to search the entry to edit by vid and mac
address and then we check the aging if we actually found an entry.

Currently the code suffer from a bug where the searched fdb entry is
never read again with the found values (if found) resulting in the code
always returning -EINVAL as aging was always 0.

Fix this by correctly read the fdb entry after it was searched.

Fixes: ba8f870dfa63 ("net: dsa: qca8k: add support for mdb_add/del")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/dsa/qca/qca8k-common.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/dsa/qca/qca8k-common.c b/drivers/net/dsa/qca/qca8k-common.c
index e7b0e94e753b..a5c09f06908d 100644
--- a/drivers/net/dsa/qca/qca8k-common.c
+++ b/drivers/net/dsa/qca/qca8k-common.c
@@ -330,6 +330,10 @@ static int qca8k_fdb_search_and_del(struct qca8k_priv *priv, u8 port_mask,
 	if (ret < 0)
 		goto exit;
 
+	ret = qca8k_fdb_read(priv, &fdb);
+	if (ret < 0)
+		goto exit;
+
 	/* Rule doesn't exist. Why delete? */
 	if (!fdb.aging) {
 		ret = -EINVAL;