Hi Dmitry, On Tue, May 20, 2025 at 11:45 AM Dmitry Antipov <dmantipov@xxxxxxxxx> wrote: > > On 5/20/25 6:31 PM, Luiz Augusto von Dentz wrote: > > > I'm afraid you were not looking into other places of the code > > regarding this, what you should have done is: > > > > list_del_rcu > > synchronize_rcu > > free > > > > synchronize_rcu will wait the threads holding rcu_read_lock so by the > > time it returns we can proceed to free because all existing readers > > should be done already and if in the meantime another thread attempts > > to iterate in the list that shall already been update given that > > list_del_rcu has updated the list. > > Got your point. OTOH 'mgmt_pending' may be currently altered by both > mgmt_pending_add() and mgmt_pending_remove(), and they may be called > from the different threads at the same time. If so, there are two > concurrent writers, and the whole thing requires an extra synchronization > beyond the one provided by RCU primitives. Am I missing something? Afaik that is no different to hci_chan_create/hci_chan_del, and other versions, which don't seem to have any problems with and they have been around for quite a while, I assume that is because of the usage of synchronize_rcu. > Dmitry > -- Luiz Augusto von Dentz