diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-06-21 10:56:05 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-06-21 10:56:05 +0200 |
commit | cfb0276373dfb5dccef0f60df0d1f7c0328918a7 (patch) | |
tree | 65c96cea2a3463baa2eb91351e5333ef44945fbd /net/core/net_namespace.c | |
parent | 04d72afa34edd14d99db7536d22819cdbb2b2e4c (diff) | |
parent | 13311e74253fe64329390df80bed3f07314ddd61 (diff) | |
download | linux-cfb0276373dfb5dccef0f60df0d1f7c0328918a7.tar.bz2 |
Merge tag 'v5.13-rc7' into usb-next
We need the USB fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r-- | net/core/net_namespace.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index 43b6ac4c4439..9b5a767eddd5 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -641,6 +641,18 @@ void __put_net(struct net *net) } EXPORT_SYMBOL_GPL(__put_net); +/** + * get_net_ns - increment the refcount of the network namespace + * @ns: common namespace (net) + * + * Returns the net's common namespace. + */ +struct ns_common *get_net_ns(struct ns_common *ns) +{ + return &get_net(container_of(ns, struct net, ns))->ns; +} +EXPORT_SYMBOL_GPL(get_net_ns); + struct net *get_net_ns_by_fd(int fd) { struct file *file; @@ -660,14 +672,8 @@ struct net *get_net_ns_by_fd(int fd) fput(file); return net; } - -#else -struct net *get_net_ns_by_fd(int fd) -{ - return ERR_PTR(-EINVAL); -} -#endif EXPORT_SYMBOL_GPL(get_net_ns_by_fd); +#endif struct net *get_net_ns_by_pid(pid_t pid) { |