Hi Vladimir,

On Sat, 31 Aug 2019 19:54:40 +0300, Vladimir Oltean <olte...@gmail.com> wrote:
> Fine, I had not noticed the "registered" field from devlink_port.
> But I fail to see how dsa_port_teardown can be entered in the generic
> case from whatever failure state dsa_port_setup left it in. What if
> it's a DSA_PORT_TYPE_CPU whose devlink_port_register failed. What will
> happen to the PHYLINK instance behind dsa_port_link_register_of (not
> to mention about data that the driver might be allocating in
> dsa_port_enable and expecting a matching disable so it won't leak)?
> And that doesn't mean the fix isn't "proper". It may be "supposed" to
> be called unconditionally on error, but right now it isn't, so I doubt
> anybody has tested that, and that there aren't corner cases. Just
> playing the safe side.

You are correct, while I think PHYLINK handles disconnecting properly,
I'm not sure dsa_port_disable is ready yet. Your proposed fix is a
safer solution in the meantime.

> > BTW that is the subtlety between "unregister" which considers that the 
> > object
> > _may_ have been registered, and "deregister" which assumes the object _was_
> 
> That concept is not familiar to me. Actually I grepped the DSA API for
> "unregister" and found:

That is not a kernel concept, I was simply pointing out the definitions
from the English language, as I found this interesting. Unfortunately
this isn't honored everywhere in the code, as you've noticed ;-)

> > registered. Would you like to go ahead and propose the devlink patch?
> 
> Nope, I don't really know what I'm getting myself into :) If you want
> to send it, I will consider it during v2.

Sure, I'll propose it myself.


Thanks,

        Vivien

Reply via email to