On Tue, Dec 20, 2016 at 05:37:20PM +0000, Alexander Bluhm wrote: > Obviosly a NET_LOCK() is missing in tcp_sysctl(). > > I think it is better to place the lock into net_sysctl() where all > the protocol sysctls are called via pr_sysctl. Then we don't have > to decide each case individually. As calling sysctl(2) is in the > slow path, doing fine grained locking has no benefit. Many sysctl > cases copy out a struct. Having a lock around that keeps the struct > consistent. >
Holding locks across copyout/copyin is always fishy. In this particular case, what happens if the access results in a page fault and the area comes from a nfs mapped file? If network i/o is done from the same context, this should result in 'locking against myself' assertion failure. That said, I'm not exactly familiar with the area, so maybe that's a false alarm. -- Mateusz Guzik <mjguzik gmail.com>