lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221006190409.881219-1-maksym.glubokiy@plvision.eu>
Date:   Thu,  6 Oct 2022 22:04:09 +0300
From:   Maksym Glubokiy <maksym.glubokiy@...ision.eu>
To:     Taras Chornyi <tchornyi@...vell.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Volodymyr Mytnyk <vmytnyk@...vell.com>,
        Serhiy Boiko <serhiy.boiko@...ision.eu>,
        Vadym Kochan <vkochan@...vell.com>
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Maksym Glubokiy <maksym.glubokiy@...ision.eu>
Subject: [PATCH net] prestera: matchall: do not rollback if rule exists

From: Serhiy Boiko <serhiy.boiko@...ision.eu>

If you try to create a 'mirror' ACL rule on a port that already has a
mirror rule, prestera_span_rule_add() will fail with EEXIST error.

This forces rollback procedure which destroys existing mirror rule on
hardware leaving it visible in linux.

Add an explicit check for EEXIST to prevent the deletion of the existing
rule but keep user seeing error message:

  $ tc filter add dev sw1p1 ... skip_sw action mirred egress mirror dev sw1p2
  $ tc filter add dev sw1p1 ... skip_sw action mirred egress mirror dev sw1p3
  RTNETLINK answers: File exists
  We have an error talking to the kernel

Fixes: 13defa275eef ("net: marvell: prestera: Add matchall support")
Signed-off-by: Serhiy Boiko <serhiy.boiko@...ision.eu>
Signed-off-by: Maksym Glubokiy <maksym.glubokiy@...ision.eu>
---
 drivers/net/ethernet/marvell/prestera/prestera_matchall.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_matchall.c b/drivers/net/ethernet/marvell/prestera/prestera_matchall.c
index 6f2b95a5263e..1da9c1bc1ee9 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_matchall.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_matchall.c
@@ -96,6 +96,8 @@ int prestera_mall_replace(struct prestera_flow_block *block,
 
 	list_for_each_entry(binding, &block->binding_list, list) {
 		err = prestera_span_rule_add(binding, port, block->ingress);
+		if (err == -EEXIST)
+			return err;
 		if (err)
 			goto rollback;
 	}
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ