mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
lockd: create NSM handles per net namespace
Commit cb7323fffa ("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>
This commit is contained in:
committed by
J. Bruce Fields
parent
aaf91ec148
commit
0ad95472bf
@@ -235,7 +235,8 @@ void nlm_rebind_host(struct nlm_host *);
|
||||
struct nlm_host * nlm_get_host(struct nlm_host *);
|
||||
void nlm_shutdown_hosts(void);
|
||||
void nlm_shutdown_hosts_net(struct net *net);
|
||||
void nlm_host_rebooted(const struct nlm_reboot *);
|
||||
void nlm_host_rebooted(const struct net *net,
|
||||
const struct nlm_reboot *);
|
||||
|
||||
/*
|
||||
* Host monitoring
|
||||
@@ -243,11 +244,13 @@ void nlm_host_rebooted(const struct nlm_reboot *);
|
||||
int nsm_monitor(const struct nlm_host *host);
|
||||
void nsm_unmonitor(const struct nlm_host *host);
|
||||
|
||||
struct nsm_handle *nsm_get_handle(const struct sockaddr *sap,
|
||||
struct nsm_handle *nsm_get_handle(const struct net *net,
|
||||
const struct sockaddr *sap,
|
||||
const size_t salen,
|
||||
const char *hostname,
|
||||
const size_t hostname_len);
|
||||
struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info);
|
||||
struct nsm_handle *nsm_reboot_lookup(const struct net *net,
|
||||
const struct nlm_reboot *info);
|
||||
void nsm_release(struct nsm_handle *nsm);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user