On Thu, 28 Jan 2021 17:11:00 -0800 Mat Martineau wrote:
> + if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL) {
> + addr_max = READ_ONCE(pernet->add_addr_signal_max);
> + WRITE_ONCE(pernet->add_addr_signal_max, addr_max + 1);
> + }
This is an odd construct.
READ_ONCE() is used when the value can change underneath the reader,
not in writers. If we want to increment a variable, there must either
be a writer side lock, or the variable has to be switched to atomic_t.
I'm guessing the former is the case here, so there can be no concurrent
writers. Please omit the READ_ONCE():
if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)
WRITE_ONCE(pernet->add_addr_signal_max,
pernet->add_addr_signal_max + 1);
Same for other 3 cases.