]> www.infradead.org Git - users/jedix/linux-maple.git/commit
lockd: create NSM handles per net namespace
authorAndrey Ryabinin <aryabinin@virtuozzo.com>
Wed, 23 Sep 2015 12:49:29 +0000 (15:49 +0300)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 22 May 2016 18:10:04 +0000 (11:10 -0700)
commit3059e949e65b8e85e5cc232cfb63ed253b082e00
tree24c9620723c5e60086533e7745172b21e328f68e
parent3e2dc7ef5bf7c5722ba462ce43dc94ab0f427212
lockd: create NSM handles per net namespace

Commit cb7323fffa85 ("lockd: create and use per-net NSM
 RPC clients on MON/UNMON requests") introduced per-net
NSM RPC clients. Unfortunately this doesn't make any sense
without per-net nsm_handle.

E.g. the following scenario could happen
Two hosts (X and Y) in different namespaces (A and B) share
the same nsm struct.

1. nsm_monitor(host_X) called => NSM rpc client created,
nsm->sm_monitored bit set.
2. nsm_mointor(host-Y) called => nsm->sm_monitored already set,
we just exit. Thus in namespace B ln->nsm_clnt == NULL.
3. host X destroyed => nsm->sm_count decremented to 1
4. host Y destroyed => nsm_unmonitor() => nsm_mon_unmon() => NULL-ptr
dereference of *ln->nsm_clnt

So this could be fixed by making per-net nsm_handles list,
instead of global. Thus different net namespaces will not be able
share the same nsm_handle.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
(cherry picked from commit 0ad95472bf169a3501991f8f33f5147f792a8116)

Orabug: 23125040

Signed-off-by: Thomas Tanaka <thomas.tanaka@oracle.com>
fs/lockd/host.c
fs/lockd/mon.c
fs/lockd/netns.h
fs/lockd/svc.c
fs/lockd/svc4proc.c
fs/lockd/svcproc.c
include/linux/lockd/lockd.h