netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: restore error path of dsa_tree_change_tag_proto
@ 2022-02-28 14:17 Vladimir Oltean
  2022-03-02  2:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Oltean @ 2022-02-28 14:17 UTC (permalink / raw)
  To: netdev
  Cc: Jakub Kicinski, David S. Miller, Florian Fainelli, Andrew Lunn,
	Vivien Didelot, Vladimir Oltean, Ansuel Smith

When the DSA_NOTIFIER_TAG_PROTO returns an error, the user space process
which initiated the protocol change exits the kernel processing while
still holding the rtnl_mutex. So any other process attempting to lock
the rtnl_mutex would deadlock after such event.

The error handling of DSA_NOTIFIER_TAG_PROTO was inadvertently changed
by the blamed commit, introducing this regression. We must still call
rtnl_unlock(), and we must still call DSA_NOTIFIER_TAG_PROTO for the old
protocol. The latter is due to the limiting design of notifier chains
for cross-chip operations, which don't have a built-in error recovery
mechanism - we should look into using notifier_call_chain_robust for that.

Fixes: dc452a471dba ("net: dsa: introduce tagger-owned storage for private and shared data")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 net/dsa/dsa2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 030d5f26715a..d3f9dbd3a815 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -1294,7 +1294,7 @@ int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst,
 	info.tag_ops = tag_ops;
 	err = dsa_tree_notify(dst, DSA_NOTIFIER_TAG_PROTO, &info);
 	if (err)
-		return err;
+		goto out_unlock;
 
 	err = dsa_tree_bind_tag_proto(dst, tag_ops);
 	if (err)
-- 
2.25.1


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

* Re: [PATCH net] net: dsa: restore error path of dsa_tree_change_tag_proto
  2022-02-28 14:17 [PATCH net] net: dsa: restore error path of dsa_tree_change_tag_proto Vladimir Oltean
@ 2022-03-02  2:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-02  2:40 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, kuba, davem, f.fainelli, andrew, vivien.didelot, olteanv,
	ansuelsmth

Hello:

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

On Mon, 28 Feb 2022 16:17:15 +0200 you wrote:
> When the DSA_NOTIFIER_TAG_PROTO returns an error, the user space process
> which initiated the protocol change exits the kernel processing while
> still holding the rtnl_mutex. So any other process attempting to lock
> the rtnl_mutex would deadlock after such event.
> 
> The error handling of DSA_NOTIFIER_TAG_PROTO was inadvertently changed
> by the blamed commit, introducing this regression. We must still call
> rtnl_unlock(), and we must still call DSA_NOTIFIER_TAG_PROTO for the old
> protocol. The latter is due to the limiting design of notifier chains
> for cross-chip operations, which don't have a built-in error recovery
> mechanism - we should look into using notifier_call_chain_robust for that.
> 
> [...]

Here is the summary with links:
  - [net] net: dsa: restore error path of dsa_tree_change_tag_proto
    https://git.kernel.org/netdev/net/c/0b0e2ff10356

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] 2+ messages in thread

end of thread, other threads:[~2022-03-02  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-28 14:17 [PATCH net] net: dsa: restore error path of dsa_tree_change_tag_proto Vladimir Oltean
2022-03-02  2:40 ` 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).