netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Two reverts to calm down devlink discussion
@ 2021-10-26 19:40 Leon Romanovsky
  2021-10-26 19:40 ` [PATCH net-next 1/2] Revert "devlink: Remove not-executed trap group notifications" Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Leon Romanovsky @ 2021-10-26 19:40 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Leon Romanovsky, Jiri Pirko, linux-kernel, netdev

From: Leon Romanovsky <leonro@nvidia.com>

Hi,

Two reverts as was discussed in [1], fast, easy and wrong in long run
solution to syzkaller bug [2].

Thanks

[1] https://lore.kernel.org/all/20211026120234.3408fbcc@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com
[2] https://lore.kernel.org/netdev/000000000000af277405cf0a7ef0@google.com/

Leon Romanovsky (2):
  Revert "devlink: Remove not-executed trap group notifications"
  Revert "devlink: Remove not-executed trap policer notifications"

 net/core/devlink.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] Revert "devlink: Remove not-executed trap group notifications"
  2021-10-26 19:40 [PATCH net-next 0/2] Two reverts to calm down devlink discussion Leon Romanovsky
@ 2021-10-26 19:40 ` Leon Romanovsky
  2021-10-26 19:40 ` [PATCH net-next 2/2] Revert "devlink: Remove not-executed trap policer notifications" Leon Romanovsky
  2021-10-27 19:10 ` [PATCH net-next 0/2] Two reverts to calm down devlink discussion patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2021-10-26 19:40 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Leon Romanovsky, Jiri Pirko, linux-kernel, netdev,
	syzbot+93d5accfaefceedf43c1

From: Leon Romanovsky <leonro@nvidia.com>

This reverts commit 8bbeed4858239ac956a78e5cbaf778bd6f3baef8 as it
revealed that mlxsw and netdevsim (copy/paste from mlxsw) reregisters
devlink objects during another devlink user triggered command.

Fixes: 22849b5ea595 ("devlink: Remove not-executed trap policer notifications")
Reported-by: syzbot+93d5accfaefceedf43c1@syzkaller.appspotmail.com
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 net/core/devlink.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index f38ef4b26f70..4dac53c77842 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -10754,7 +10754,8 @@ devlink_trap_group_notify(struct devlink *devlink,
 
 	WARN_ON_ONCE(cmd != DEVLINK_CMD_TRAP_GROUP_NEW &&
 		     cmd != DEVLINK_CMD_TRAP_GROUP_DEL);
-	ASSERT_DEVLINK_REGISTERED(devlink);
+	if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))
+		return;
 
 	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
 	if (!msg)
@@ -11081,6 +11082,9 @@ devlink_trap_group_register(struct devlink *devlink,
 	}
 
 	list_add_tail(&group_item->list, &devlink->trap_group_list);
+	devlink_trap_group_notify(devlink, group_item,
+				  DEVLINK_CMD_TRAP_GROUP_NEW);
+
 	return 0;
 
 err_group_init:
@@ -11101,6 +11105,8 @@ devlink_trap_group_unregister(struct devlink *devlink,
 	if (WARN_ON_ONCE(!group_item))
 		return;
 
+	devlink_trap_group_notify(devlink, group_item,
+				  DEVLINK_CMD_TRAP_GROUP_DEL);
 	list_del(&group_item->list);
 	free_percpu(group_item->stats);
 	kfree(group_item);
@@ -11120,8 +11126,6 @@ int devlink_trap_groups_register(struct devlink *devlink,
 {
 	int i, err;
 
-	ASSERT_DEVLINK_NOT_REGISTERED(devlink);
-
 	mutex_lock(&devlink->lock);
 	for (i = 0; i < groups_count; i++) {
 		const struct devlink_trap_group *group = &groups[i];
@@ -11159,8 +11163,6 @@ void devlink_trap_groups_unregister(struct devlink *devlink,
 {
 	int i;
 
-	ASSERT_DEVLINK_NOT_REGISTERED(devlink);
-
 	mutex_lock(&devlink->lock);
 	for (i = groups_count - 1; i >= 0; i--)
 		devlink_trap_group_unregister(devlink, &groups[i]);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] Revert "devlink: Remove not-executed trap policer notifications"
  2021-10-26 19:40 [PATCH net-next 0/2] Two reverts to calm down devlink discussion Leon Romanovsky
  2021-10-26 19:40 ` [PATCH net-next 1/2] Revert "devlink: Remove not-executed trap group notifications" Leon Romanovsky
@ 2021-10-26 19:40 ` Leon Romanovsky
  2021-10-27 19:10 ` [PATCH net-next 0/2] Two reverts to calm down devlink discussion patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2021-10-26 19:40 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski
  Cc: Leon Romanovsky, Jiri Pirko, linux-kernel, netdev

From: Leon Romanovsky <leonro@nvidia.com>

This reverts commit 22849b5ea5952d853547cc5e0651f34a246b2a4f as it
revealed that mlxsw and netdevsim (copy/paste from mlxsw) reregisters
devlink objects during another devlink user triggered command.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 net/core/devlink.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index 4dac53c77842..0de679c4313c 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -11180,7 +11180,8 @@ devlink_trap_policer_notify(struct devlink *devlink,
 
 	WARN_ON_ONCE(cmd != DEVLINK_CMD_TRAP_POLICER_NEW &&
 		     cmd != DEVLINK_CMD_TRAP_POLICER_DEL);
-	ASSERT_DEVLINK_REGISTERED(devlink);
+	if (!xa_get_mark(&devlinks, devlink->index, DEVLINK_REGISTERED))
+		return;
 
 	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
 	if (!msg)
@@ -11222,6 +11223,9 @@ devlink_trap_policer_register(struct devlink *devlink,
 	}
 
 	list_add_tail(&policer_item->list, &devlink->trap_policer_list);
+	devlink_trap_policer_notify(devlink, policer_item,
+				    DEVLINK_CMD_TRAP_POLICER_NEW);
+
 	return 0;
 
 err_policer_init:
@@ -11239,6 +11243,8 @@ devlink_trap_policer_unregister(struct devlink *devlink,
 	if (WARN_ON_ONCE(!policer_item))
 		return;
 
+	devlink_trap_policer_notify(devlink, policer_item,
+				    DEVLINK_CMD_TRAP_POLICER_DEL);
 	list_del(&policer_item->list);
 	if (devlink->ops->trap_policer_fini)
 		devlink->ops->trap_policer_fini(devlink, policer);
@@ -11260,8 +11266,6 @@ devlink_trap_policers_register(struct devlink *devlink,
 {
 	int i, err;
 
-	ASSERT_DEVLINK_NOT_REGISTERED(devlink);
-
 	mutex_lock(&devlink->lock);
 	for (i = 0; i < policers_count; i++) {
 		const struct devlink_trap_policer *policer = &policers[i];
@@ -11303,8 +11307,6 @@ devlink_trap_policers_unregister(struct devlink *devlink,
 {
 	int i;
 
-	ASSERT_DEVLINK_NOT_REGISTERED(devlink);
-
 	mutex_lock(&devlink->lock);
 	for (i = policers_count - 1; i >= 0; i--)
 		devlink_trap_policer_unregister(devlink, &policers[i]);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] Two reverts to calm down devlink discussion
  2021-10-26 19:40 [PATCH net-next 0/2] Two reverts to calm down devlink discussion Leon Romanovsky
  2021-10-26 19:40 ` [PATCH net-next 1/2] Revert "devlink: Remove not-executed trap group notifications" Leon Romanovsky
  2021-10-26 19:40 ` [PATCH net-next 2/2] Revert "devlink: Remove not-executed trap policer notifications" Leon Romanovsky
@ 2021-10-27 19:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-27 19:10 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: davem, kuba, leonro, jiri, linux-kernel, netdev

Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 26 Oct 2021 22:40:40 +0300 you wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> Hi,
> 
> Two reverts as was discussed in [1], fast, easy and wrong in long run
> solution to syzkaller bug [2].
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] Revert "devlink: Remove not-executed trap group notifications"
    https://git.kernel.org/netdev/net-next/c/fb9d19c2d844
  - [net-next,2/2] Revert "devlink: Remove not-executed trap policer notifications"
    https://git.kernel.org/netdev/net-next/c/c5e0321e43de

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-27 19:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-26 19:40 [PATCH net-next 0/2] Two reverts to calm down devlink discussion Leon Romanovsky
2021-10-26 19:40 ` [PATCH net-next 1/2] Revert "devlink: Remove not-executed trap group notifications" Leon Romanovsky
2021-10-26 19:40 ` [PATCH net-next 2/2] Revert "devlink: Remove not-executed trap policer notifications" Leon Romanovsky
2021-10-27 19:10 ` [PATCH net-next 0/2] Two reverts to calm down devlink discussion patchwork-bot+netdevbpf

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).