[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250916080347.es66wv7esea6v4oc@skbuf>
Date: Tue, 16 Sep 2025 11:03:47 +0300
From: Vladimir Oltean <olteanv@...il.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
Paolo Abeni <pabeni@...hat.com>,
Richard Cochran <richardcochran@...il.com>
Subject: Re: [PATCH net-next] net: dsa: mv88e6xxx: clean up PTP clock during
setup failure
On Mon, Sep 15, 2025 at 01:13:06PM +0100, Russell King (Oracle) wrote:
> If an error occurs during mv88e6xxx_setup() and the PTP clock has been
> registered, the clock will not be unregistered as mv88e6xxx_ptp_free()
> will not be called. mv88e6xxx_hwtstamp_free() also is not called.
>
> As mv88e6xxx_ptp_free() can cope with being called without a successful
> call to mv88e6xxx_ptp_setup(), and mv88e6xxx_hwtstamp_free() is empty,
> add both these *_free() calls to the error cleanup paths in
> mv88e6xxx_setup().
>
> Moreover, mv88e6xxx_teardown() should teardown setup done in
> mv88e6xxx_setup() - see dsa_switch_setup(). However, instead *_free()
> are called from mv88e6xxx_remove() function that is only called when a
> device is unbound, which omits cleanup should a failure occur later in
> dsa_switch_setup(). Move the *_free() calls from mv88e6xxx_remove() to
> mv88e6xxx_teardown().
>
> Note that mv88e6xxx_ptp_setup() must be called holding the reg_lock,
> but mv88e6xxx_ptp_free() must never be. This is especially true after
> commit "ptp: rework ptp_clock_unregister() to disable events". This
> patch does not change this, but adds a comment to that effect.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
Reviewed-by: Vladimir Oltean <olteanv@...il.com>
Powered by blists - more mailing lists