[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250707171118.55fc88cc@kernel.org>
Date: Mon, 7 Jul 2025 17:11:18 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jeongjun Park <aha310510@...il.com>
Cc: richardcochran@...il.com, andrew+netdev@...n.ch, davem@...emloft.net,
edumazet@...gle.com, pabeni@...hat.com, yangbo.lu@....com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+7cfb66a237c4a5fb22ad@...kaller.appspotmail.com
Subject: Re: [PATCH net] ptp: prevent possible ABBA deadlock in
ptp_clock_freerun()
On Sat, 5 Jul 2025 23:50:31 +0900 Jeongjun Park wrote:
> ABBA deadlock occurs in the following scenario:
>
> CPU0 CPU1
> ---- ----
> n_vclocks_store()
> lock(&ptp->n_vclocks_mux) [1]
> pc_clock_adjtime()
> lock(&clk->rwsem) [2]
> ...
> ptp_clock_freerun()
> ptp_vclock_in_use()
> lock(&ptp->n_vclocks_mux) [3]
> ptp_clock_unregister()
> posix_clock_unregister()
> lock(&clk->rwsem) [4]
>
> To solve this with minimal patches, we should change ptp_clock_freerun()
> to briefly release the read lock before calling ptp_vclock_in_use() and
> then re-lock it when we're done.
Dropping locks randomly is very rarely the correct fix.
Either way - you forgot to CC Vladimir, again.
--
pw-bot: cr
Powered by blists - more mailing lists