All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next] net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails
@ 2022-03-03 14:08 Vladimir Oltean
  2022-03-05  4:56 ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Oltean @ 2022-03-03 14:08 UTC (permalink / raw)
  To: netdev
  Cc: Jakub Kicinski, David S. Miller, Florian Fainelli, Andrew Lunn,
	Vivien Didelot, Vladimir Oltean

After the blamed commit, dsa_tree_setup_master() may exit without
calling rtnl_unlock(), fix that.

Fixes: c146f9bc195a ("net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown}")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
v1->v2: actually propagate the error code instead of always returning 0

 net/dsa/dsa2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 030d5f26715a..d26430e33096 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -1072,7 +1072,7 @@ static int dsa_tree_setup_switches(struct dsa_switch_tree *dst)
 static int dsa_tree_setup_master(struct dsa_switch_tree *dst)
 {
 	struct dsa_port *dp;
-	int err;
+	int err = 0;
 
 	rtnl_lock();
 
@@ -1084,7 +1084,7 @@ static int dsa_tree_setup_master(struct dsa_switch_tree *dst)
 
 			err = dsa_master_setup(master, dp);
 			if (err)
-				return err;
+				break;
 
 			/* Replay master state event */
 			dsa_tree_master_admin_state_change(dst, master, admin_up);
@@ -1095,7 +1095,7 @@ static int dsa_tree_setup_master(struct dsa_switch_tree *dst)
 
 	rtnl_unlock();
 
-	return 0;
+	return err;
 }
 
 static void dsa_tree_teardown_master(struct dsa_switch_tree *dst)
-- 
2.25.1


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

* Re: [PATCH v2 net-next] net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails
  2022-03-03 14:08 [PATCH v2 net-next] net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails Vladimir Oltean
@ 2022-03-05  4:56 ` Jakub Kicinski
  2022-03-05 12:32   ` Vladimir Oltean
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2022-03-05  4:56 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: netdev, David S. Miller, Florian Fainelli, Andrew Lunn,
	Vivien Didelot, Vladimir Oltean

On Thu,  3 Mar 2022 16:08:40 +0200 Vladimir Oltean wrote:
> Subject: [PATCH v2 net-next] net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails

Did you mean s/-next//?

> After the blamed commit, dsa_tree_setup_master() may exit without
> calling rtnl_unlock(), fix that.
> 
> Fixes: c146f9bc195a ("net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown}")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
> v1->v2: actually propagate the error code instead of always returning 0

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

* Re: [PATCH v2 net-next] net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails
  2022-03-05  4:56 ` Jakub Kicinski
@ 2022-03-05 12:32   ` Vladimir Oltean
  2022-03-07 21:44     ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Oltean @ 2022-03-05 12:32 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Vladimir Oltean, netdev, David S. Miller, Florian Fainelli,
	Andrew Lunn, Vivien Didelot

On Fri, Mar 04, 2022 at 08:56:59PM -0800, Jakub Kicinski wrote:
> On Thu,  3 Mar 2022 16:08:40 +0200 Vladimir Oltean wrote:
> > Subject: [PATCH v2 net-next] net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails
> 
> Did you mean s/-next//?

I really meant net-next, but now I see that I was wrong.
What I did was:

git tag --contains c146f9bc195a
v5.17-rc1
v5.17-rc2
v5.17-rc3
v5.17-rc4
v5.17-rc5
v5.17-rc6

and from this I drew the incorrect conclusion that the patch was merged
during the v5.17 rc's, for inclusion in v5.18.

> 
> > After the blamed commit, dsa_tree_setup_master() may exit without
> > calling rtnl_unlock(), fix that.
> > 
> > Fixes: c146f9bc195a ("net: dsa: hold rtnl_mutex when calling dsa_master_{setup,teardown}")
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > ---
> > v1->v2: actually propagate the error code instead of always returning 0

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

* Re: [PATCH v2 net-next] net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails
  2022-03-05 12:32   ` Vladimir Oltean
@ 2022-03-07 21:44     ` Jakub Kicinski
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2022-03-07 21:44 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: Vladimir Oltean, netdev, David S. Miller, Florian Fainelli,
	Andrew Lunn, Vivien Didelot

On Sat, 5 Mar 2022 14:32:34 +0200 Vladimir Oltean wrote:
> On Fri, Mar 04, 2022 at 08:56:59PM -0800, Jakub Kicinski wrote:
> > On Thu,  3 Mar 2022 16:08:40 +0200 Vladimir Oltean wrote:  
> > > Subject: [PATCH v2 net-next] net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails  
> > 
> > Did you mean s/-next//?  
> 
> I really meant net-next, but now I see that I was wrong.
> What I did was:
> 
> git tag --contains c146f9bc195a
> v5.17-rc1
> v5.17-rc2
> v5.17-rc3
> v5.17-rc4
> v5.17-rc5
> v5.17-rc6
> 
> and from this I drew the incorrect conclusion that the patch was merged
> during the v5.17 rc's, for inclusion in v5.18.

Yeah, git tag --contains is finicky, I gave up on using it :(

The patch appears to now be commit afb3cc1a397d ("net: dsa: unlock the
rtnl_mutex when dsa_master_setup() fails") in net, thanks!

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

end of thread, other threads:[~2022-03-07 21:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 14:08 [PATCH v2 net-next] net: dsa: unlock the rtnl_mutex when dsa_master_setup() fails Vladimir Oltean
2022-03-05  4:56 ` Jakub Kicinski
2022-03-05 12:32   ` Vladimir Oltean
2022-03-07 21:44     ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.