netfilter: nf_log: don't hold nf_log_mutex during user access
authorJann Horn <jannh@google.com>
Mon, 25 Jun 2018 15:22:00 +0000 (17:22 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 26 Jun 2018 14:48:40 +0000 (16:48 +0200)
commitce00bf07cc95a57cd20b208e02b3c2604e532ae8
tree84e98d9b5c39e5655d98abd3fc4e419f89e4969f
parentdffd22aed2aa1e804bccf19b30a421e89ee2ae61
netfilter: nf_log: don't hold nf_log_mutex during user access

The old code would indefinitely block other users of nf_log_mutex if
a userspace access in proc_dostring() blocked e.g. due to a userfaultfd
region. Fix it by moving proc_dostring() out of the locked region.

This is a followup to commit 266d07cb1c9a ("netfilter: nf_log: fix
sleeping function called from invalid context"), which changed this code
from using rcu_read_lock() to taking nf_log_mutex.

Fixes: 266d07cb1c9a ("netfilter: nf_log: fix sleeping function calle[...]")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_log.c