Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'vfs-7.0-rc8.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs fixes from Christian Brauner:
"The kernfs rbtree is keyed by (hash, ns, name) where the hash
is seeded with the raw namespace pointer via init_name_hash(ns).

The resulting hash values are exposed to userspace through
readdir seek positions, and the pointer-based ordering in
kernfs_name_compare() is observable through entry order.

Switch from raw pointers to ns_common::ns_id for both hashing
and comparison.

A preparatory commit first replaces all const void * namespace
parameters with const struct ns_common * throughout kernfs, sysfs,
and kobject so the code can access ns->ns_id. Also compare the
ns_id when hashes match in the rbtree to handle crafted collisions.

Also fix eventpoll RCU grace period issue and a cachefiles refcount
problem"

* tag 'vfs-7.0-rc8.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
kernfs: make directory seek namespace-aware
kernfs: use namespace id instead of pointer for hashing and comparison
kernfs: pass struct ns_common instead of const void * for namespace tags
eventpoll: defer struct eventpoll free to RCU grace period
cachefiles: fix incorrect dentry refcount in cachefiles_cull()

+216 -156
+2 -2
drivers/base/class.c
··· 127 127 }; 128 128 129 129 int class_create_file_ns(const struct class *cls, const struct class_attribute *attr, 130 - const void *ns) 130 + const struct ns_common *ns) 131 131 { 132 132 struct subsys_private *sp = class_to_subsys(cls); 133 133 int error; ··· 143 143 EXPORT_SYMBOL_GPL(class_create_file_ns); 144 144 145 145 void class_remove_file_ns(const struct class *cls, const struct class_attribute *attr, 146 - const void *ns) 146 + const struct ns_common *ns) 147 147 { 148 148 struct subsys_private *sp = class_to_subsys(cls); 149 149
+3 -4
drivers/base/core.c
··· 2570 2570 kfree(p); 2571 2571 } 2572 2572 2573 - static const void *device_namespace(const struct kobject *kobj) 2573 + static const struct ns_common *device_namespace(const struct kobject *kobj) 2574 2574 { 2575 2575 const struct device *dev = kobj_to_dev(kobj); 2576 - const void *ns = NULL; 2577 2576 2578 2577 if (dev->class && dev->class->namespace) 2579 - ns = dev->class->namespace(dev); 2578 + return dev->class->namespace(dev); 2580 2579 2581 - return ns; 2580 + return NULL; 2582 2581 } 2583 2582 2584 2583 static void device_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t *gid)
+3 -2
drivers/infiniband/core/device.c
··· 509 509 return 0; 510 510 } 511 511 512 - static const void *net_namespace(const struct device *d) 512 + static const struct ns_common *net_namespace(const struct device *d) 513 513 { 514 514 const struct ib_core_device *coredev = 515 515 container_of(d, struct ib_core_device, dev); 516 + struct net *net = read_pnet(&coredev->rdma_net); 516 517 517 - return read_pnet(&coredev->rdma_net); 518 + return net ? to_ns_common(net) : NULL; 518 519 } 519 520 520 521 static struct class ib_class = {
+4 -3
drivers/infiniband/ulp/srp/ib_srp.c
··· 43 43 #include <linux/jiffies.h> 44 44 #include <linux/lockdep.h> 45 45 #include <linux/inet.h> 46 + #include <net/net_namespace.h> 46 47 #include <rdma/ib_cache.h> 47 48 48 49 #include <linux/atomic.h> ··· 1049 1048 scsi_remove_host(target->scsi_host); 1050 1049 srp_stop_rport_timers(target->rport); 1051 1050 srp_disconnect_target(target); 1052 - kobj_ns_drop(KOBJ_NS_TYPE_NET, target->net); 1051 + kobj_ns_drop(KOBJ_NS_TYPE_NET, to_ns_common(target->net)); 1053 1052 for (i = 0; i < target->ch_count; i++) { 1054 1053 ch = &target->ch[i]; 1055 1054 srp_free_ch_ib(target, ch); ··· 3714 3713 3715 3714 target = host_to_target(target_host); 3716 3715 3717 - target->net = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); 3716 + target->net = to_net_ns(kobj_ns_grab_current(KOBJ_NS_TYPE_NET)); 3718 3717 target->io_class = SRP_REV16A_IB_IO_CLASS; 3719 3718 target->scsi_host = target_host; 3720 3719 target->srp_host = host; ··· 3906 3905 * earlier in this function. 3907 3906 */ 3908 3907 if (target->state != SRP_TARGET_REMOVED) 3909 - kobj_ns_drop(KOBJ_NS_TYPE_NET, target->net); 3908 + kobj_ns_drop(KOBJ_NS_TYPE_NET, to_ns_common(target->net)); 3910 3909 scsi_host_put(target->scsi_host); 3911 3910 } 3912 3911
+2 -2
drivers/net/bonding/bond_sysfs.c
··· 808 808 sysfs_attr_init(&bn->class_attr_bonding_masters.attr); 809 809 810 810 ret = netdev_class_create_file_ns(&bn->class_attr_bonding_masters, 811 - bn->net); 811 + to_ns_common(bn->net)); 812 812 /* Permit multiple loads of the module by ignoring failures to 813 813 * create the bonding_masters sysfs file. Bonding devices 814 814 * created by second or subsequent loads of the module will ··· 835 835 /* Remove /sys/class/net/bonding_masters. */ 836 836 void __net_exit bond_destroy_sysfs(struct bond_net *bn) 837 837 { 838 - netdev_class_remove_file_ns(&bn->class_attr_bonding_masters, bn->net); 838 + netdev_class_remove_file_ns(&bn->class_attr_bonding_masters, to_ns_common(bn->net)); 839 839 } 840 840 841 841 /* Initialize sysfs for each bond. This sets up and registers
+3 -2
drivers/net/ipvlan/ipvtap.c
··· 30 30 static dev_t ipvtap_major; 31 31 static struct cdev ipvtap_cdev; 32 32 33 - static const void *ipvtap_net_namespace(const struct device *d) 33 + static const struct ns_common *ipvtap_net_namespace(const struct device *d) 34 34 { 35 35 const struct net_device *dev = to_net_dev(d->parent); 36 - return dev_net(dev); 36 + 37 + return to_ns_common(dev_net(dev)); 37 38 } 38 39 39 40 static struct class ipvtap_class = {
+3 -2
drivers/net/macvtap.c
··· 35 35 */ 36 36 static dev_t macvtap_major; 37 37 38 - static const void *macvtap_net_namespace(const struct device *d) 38 + static const struct ns_common *macvtap_net_namespace(const struct device *d) 39 39 { 40 40 const struct net_device *dev = to_net_dev(d->parent); 41 - return dev_net(dev); 41 + 42 + return to_ns_common(dev_net(dev)); 42 43 } 43 44 44 45 static struct class macvtap_class = {
+5
fs/cachefiles/namei.c
··· 810 810 if (ret < 0) 811 811 goto error_unlock; 812 812 813 + /* 814 + * cachefiles_bury_object() expects 2 references to 'victim', 815 + * and drops one. 816 + */ 817 + dget(victim); 813 818 ret = cachefiles_bury_object(cache, NULL, dir, victim, 814 819 FSCACHE_OBJECT_WAS_CULLED); 815 820 dput(victim);
+5 -1
fs/eventpoll.c
··· 226 226 */ 227 227 refcount_t refcount; 228 228 229 + /* used to defer freeing past ep_get_upwards_depth_proc() RCU walk */ 230 + struct rcu_head rcu; 231 + 229 232 #ifdef CONFIG_NET_RX_BUSY_POLL 230 233 /* used to track busy poll napi_id */ 231 234 unsigned int napi_id; ··· 822 819 mutex_destroy(&ep->mtx); 823 820 free_uid(ep->user); 824 821 wakeup_source_unregister(ep->ws); 825 - kfree(ep); 822 + /* ep_get_upwards_depth_proc() may still hold epi->ep under RCU */ 823 + kfree_rcu(ep, rcu); 826 824 } 827 825 828 826 /*
+48 -20
fs/kernfs/dir.c
··· 14 14 #include <linux/slab.h> 15 15 #include <linux/security.h> 16 16 #include <linux/hash.h> 17 + #include <linux/ns_common.h> 17 18 18 19 #include "kernfs-internal.h" 19 20 ··· 307 306 return parent; 308 307 } 309 308 309 + /* 310 + * kernfs_ns_id - return the namespace id for a given namespace 311 + * @ns: namespace tag (may be NULL) 312 + * 313 + * Use the 64-bit namespace id instead of raw pointers for hashing 314 + * and comparison to avoid leaking kernel addresses to userspace. 315 + */ 316 + static u64 kernfs_ns_id(const struct ns_common *ns) 317 + { 318 + return ns ? ns->ns_id : 0; 319 + } 320 + 310 321 /** 311 322 * kernfs_name_hash - calculate hash of @ns + @name 312 323 * @name: Null terminated string to hash ··· 326 313 * 327 314 * Return: 31-bit hash of ns + name (so it fits in an off_t) 328 315 */ 329 - static unsigned int kernfs_name_hash(const char *name, const void *ns) 316 + static unsigned int kernfs_name_hash(const char *name, 317 + const struct ns_common *ns) 330 318 { 331 - unsigned long hash = init_name_hash(ns); 319 + unsigned long hash = init_name_hash(kernfs_ns_id(ns)); 332 320 unsigned int len = strlen(name); 333 321 while (len--) 334 322 hash = partial_name_hash(*name++, hash); ··· 344 330 } 345 331 346 332 static int kernfs_name_compare(unsigned int hash, const char *name, 347 - const void *ns, const struct kernfs_node *kn) 333 + const struct ns_common *ns, const struct kernfs_node *kn) 348 334 { 335 + u64 ns_id = kernfs_ns_id(ns); 336 + u64 kn_ns_id = kernfs_ns_id(kn->ns); 337 + 349 338 if (hash < kn->hash) 350 339 return -1; 351 340 if (hash > kn->hash) 352 341 return 1; 353 - if (ns < kn->ns) 342 + if (ns_id < kn_ns_id) 354 343 return -1; 355 - if (ns > kn->ns) 344 + if (ns_id > kn_ns_id) 356 345 return 1; 357 346 return strcmp(name, kernfs_rcu_name(kn)); 358 347 } ··· 873 856 */ 874 857 static struct kernfs_node *kernfs_find_ns(struct kernfs_node *parent, 875 858 const unsigned char *name, 876 - const void *ns) 859 + const struct ns_common *ns) 877 860 { 878 861 struct rb_node *node = parent->dir.children.rb_node; 879 862 bool has_ns = kernfs_ns_enabled(parent); ··· 906 889 907 890 static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *parent, 908 891 const unsigned char *path, 909 - const void *ns) 892 + const struct ns_common *ns) 910 893 { 911 894 ssize_t len; 912 895 char *p, *name; ··· 947 930 * Return: pointer to the found kernfs_node on success, %NULL on failure. 948 931 */ 949 932 struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent, 950 - const char *name, const void *ns) 933 + const char *name, 934 + const struct ns_common *ns) 951 935 { 952 936 struct kernfs_node *kn; 953 937 struct kernfs_root *root = kernfs_root(parent); ··· 974 956 * Return: pointer to the found kernfs_node on success, %NULL on failure. 975 957 */ 976 958 struct kernfs_node *kernfs_walk_and_get_ns(struct kernfs_node *parent, 977 - const char *path, const void *ns) 959 + const char *path, 960 + const struct ns_common *ns) 978 961 { 979 962 struct kernfs_node *kn; 980 963 struct kernfs_root *root = kernfs_root(parent); ··· 1098 1079 struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, 1099 1080 const char *name, umode_t mode, 1100 1081 kuid_t uid, kgid_t gid, 1101 - void *priv, const void *ns) 1082 + void *priv, 1083 + const struct ns_common *ns) 1102 1084 { 1103 1085 struct kernfs_node *kn; 1104 1086 int rc; ··· 1219 1199 1220 1200 /* The kernfs node has been moved to a different namespace */ 1221 1201 if (parent && kernfs_ns_enabled(parent) && 1222 - kernfs_info(dentry->d_sb)->ns != kn->ns) 1202 + kernfs_ns_id(kernfs_info(dentry->d_sb)->ns) != kernfs_ns_id(kn->ns)) 1223 1203 goto out_bad; 1224 1204 1225 1205 up_read(&root->kernfs_rwsem); ··· 1241 1221 struct kernfs_node *kn; 1242 1222 struct kernfs_root *root; 1243 1223 struct inode *inode = NULL; 1244 - const void *ns = NULL; 1224 + const struct ns_common *ns = NULL; 1245 1225 1246 1226 root = kernfs_root(parent); 1247 1227 down_read(&root->kernfs_rwsem); ··· 1722 1702 * Return: %0 on success, -ENOENT if such entry doesn't exist. 1723 1703 */ 1724 1704 int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, 1725 - const void *ns) 1705 + const struct ns_common *ns) 1726 1706 { 1727 1707 struct kernfs_node *kn; 1728 1708 struct kernfs_root *root; ··· 1761 1741 * Return: %0 on success, -errno on failure. 1762 1742 */ 1763 1743 int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent, 1764 - const char *new_name, const void *new_ns) 1744 + const char *new_name, const struct ns_common *new_ns) 1765 1745 { 1766 1746 struct kernfs_node *old_parent; 1767 1747 struct kernfs_root *root; ··· 1791 1771 old_name = kernfs_rcu_name(kn); 1792 1772 if (!new_name) 1793 1773 new_name = old_name; 1794 - if ((old_parent == new_parent) && (kn->ns == new_ns) && 1774 + if ((old_parent == new_parent) && 1775 + (kernfs_ns_id(kn->ns) == kernfs_ns_id(new_ns)) && 1795 1776 (strcmp(old_name, new_name) == 0)) 1796 1777 goto out; /* nothing to rename */ 1797 1778 ··· 1853 1832 return 0; 1854 1833 } 1855 1834 1856 - static struct kernfs_node *kernfs_dir_pos(const void *ns, 1835 + static struct kernfs_node *kernfs_dir_pos(const struct ns_common *ns, 1857 1836 struct kernfs_node *parent, loff_t hash, struct kernfs_node *pos) 1858 1837 { 1859 1838 if (pos) { ··· 1866 1845 } 1867 1846 if (!pos && (hash > 1) && (hash < INT_MAX)) { 1868 1847 struct rb_node *node = parent->dir.children.rb_node; 1848 + u64 ns_id = kernfs_ns_id(ns); 1869 1849 while (node) { 1870 1850 pos = rb_to_kn(node); 1871 1851 ··· 1874 1852 node = node->rb_left; 1875 1853 else if (hash > pos->hash) 1876 1854 node = node->rb_right; 1855 + else if (ns_id < kernfs_ns_id(pos->ns)) 1856 + node = node->rb_left; 1857 + else if (ns_id > kernfs_ns_id(pos->ns)) 1858 + node = node->rb_right; 1877 1859 else 1878 1860 break; 1879 1861 } 1880 1862 } 1881 1863 /* Skip over entries which are dying/dead or in the wrong namespace */ 1882 - while (pos && (!kernfs_active(pos) || pos->ns != ns)) { 1864 + while (pos && (!kernfs_active(pos) || 1865 + kernfs_ns_id(pos->ns) != kernfs_ns_id(ns))) { 1883 1866 struct rb_node *node = rb_next(&pos->rb); 1884 1867 if (!node) 1885 1868 pos = NULL; ··· 1894 1867 return pos; 1895 1868 } 1896 1869 1897 - static struct kernfs_node *kernfs_dir_next_pos(const void *ns, 1870 + static struct kernfs_node *kernfs_dir_next_pos(const struct ns_common *ns, 1898 1871 struct kernfs_node *parent, ino_t ino, struct kernfs_node *pos) 1899 1872 { 1900 1873 pos = kernfs_dir_pos(ns, parent, ino, pos); ··· 1905 1878 pos = NULL; 1906 1879 else 1907 1880 pos = rb_to_kn(node); 1908 - } while (pos && (!kernfs_active(pos) || pos->ns != ns)); 1881 + } while (pos && (!kernfs_active(pos) || 1882 + kernfs_ns_id(pos->ns) != kernfs_ns_id(ns))); 1909 1883 } 1910 1884 return pos; 1911 1885 } ··· 1917 1889 struct kernfs_node *parent = kernfs_dentry_node(dentry); 1918 1890 struct kernfs_node *pos = file->private_data; 1919 1891 struct kernfs_root *root; 1920 - const void *ns = NULL; 1892 + const struct ns_common *ns = NULL; 1921 1893 1922 1894 if (!dir_emit_dots(file, ctx)) 1923 1895 return 0;
+1 -1
fs/kernfs/file.c
··· 1045 1045 umode_t mode, kuid_t uid, kgid_t gid, 1046 1046 loff_t size, 1047 1047 const struct kernfs_ops *ops, 1048 - void *priv, const void *ns, 1048 + void *priv, const struct ns_common *ns, 1049 1049 struct lock_class_key *key) 1050 1050 { 1051 1051 struct kernfs_node *kn;
+1 -1
fs/kernfs/kernfs-internal.h
··· 97 97 * instance. If multiple tags become necessary, make the following 98 98 * an array and compare kernfs_node tag against every entry. 99 99 */ 100 - const void *ns; 100 + const struct ns_common *ns; 101 101 102 102 /* anchored at kernfs_root->supers, protected by kernfs_rwsem */ 103 103 struct list_head node;
+1 -1
fs/kernfs/mount.c
··· 345 345 * 346 346 * Return: the namespace tag associated with kernfs super_block @sb. 347 347 */ 348 - const void *kernfs_super_ns(struct super_block *sb) 348 + const struct ns_common *kernfs_super_ns(struct super_block *sb) 349 349 { 350 350 struct kernfs_super_info *info = kernfs_info(sb); 351 351
+10 -6
fs/nfs/sysfs.c
··· 11 11 #include <linux/netdevice.h> 12 12 #include <linux/string.h> 13 13 #include <linux/nfs_fs.h> 14 + #include <net/net_namespace.h> 14 15 #include <linux/rcupdate.h> 15 16 #include <linux/lockd/lockd.h> 16 17 ··· 128 127 kfree(rcu_dereference_raw(c->identifier)); 129 128 } 130 129 131 - static const void *nfs_netns_client_namespace(const struct kobject *kobj) 130 + static const struct ns_common *nfs_netns_client_namespace(const struct kobject *kobj) 132 131 { 133 - return container_of(kobj, struct nfs_netns_client, kobject)->net; 132 + return to_ns_common(container_of(kobj, struct nfs_netns_client, 133 + kobject)->net); 134 134 } 135 135 136 136 static struct kobj_attribute nfs_netns_client_id = __ATTR(identifier, ··· 158 156 kfree(c); 159 157 } 160 158 161 - static const void *nfs_netns_namespace(const struct kobject *kobj) 159 + static const struct ns_common *nfs_netns_namespace(const struct kobject *kobj) 162 160 { 163 - return container_of(kobj, struct nfs_netns_client, nfs_net_kobj)->net; 161 + return to_ns_common(container_of(kobj, struct nfs_netns_client, 162 + nfs_net_kobj)->net); 164 163 } 165 164 166 165 static struct kobj_type nfs_netns_object_type = { ··· 353 350 /* no-op: why? see lib/kobject.c kobject_cleanup() */ 354 351 } 355 352 356 - static const void *nfs_netns_server_namespace(const struct kobject *kobj) 353 + static const struct ns_common *nfs_netns_server_namespace(const struct kobject *kobj) 357 354 { 358 - return container_of(kobj, struct nfs_server, kobj)->nfs_client->cl_net; 355 + return to_ns_common(container_of(kobj, struct nfs_server, 356 + kobj)->nfs_client->cl_net); 359 357 } 360 358 361 359 static struct kobj_type nfs_sb_ktype = {
+3 -3
fs/sysfs/dir.c
··· 37 37 * @kobj: object we're creating directory for 38 38 * @ns: the namespace tag to use 39 39 */ 40 - int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) 40 + int sysfs_create_dir_ns(struct kobject *kobj, const struct ns_common *ns) 41 41 { 42 42 struct kernfs_node *parent, *kn; 43 43 kuid_t uid; ··· 103 103 } 104 104 105 105 int sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name, 106 - const void *new_ns) 106 + const struct ns_common *new_ns) 107 107 { 108 108 struct kernfs_node *parent; 109 109 int ret; ··· 115 115 } 116 116 117 117 int sysfs_move_dir_ns(struct kobject *kobj, struct kobject *new_parent_kobj, 118 - const void *new_ns) 118 + const struct ns_common *new_ns) 119 119 { 120 120 struct kernfs_node *kn = kobj->sd; 121 121 struct kernfs_node *new_parent;
+4 -4
fs/sysfs/file.c
··· 272 272 273 273 int sysfs_add_file_mode_ns(struct kernfs_node *parent, 274 274 const struct attribute *attr, umode_t mode, kuid_t uid, 275 - kgid_t gid, const void *ns) 275 + kgid_t gid, const struct ns_common *ns) 276 276 { 277 277 struct kobject *kobj = parent->priv; 278 278 const struct sysfs_ops *sysfs_ops = kobj->ktype->sysfs_ops; ··· 322 322 323 323 int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent, 324 324 const struct bin_attribute *battr, umode_t mode, size_t size, 325 - kuid_t uid, kgid_t gid, const void *ns) 325 + kuid_t uid, kgid_t gid, const struct ns_common *ns) 326 326 { 327 327 const struct attribute *attr = &battr->attr; 328 328 struct lock_class_key *key = NULL; ··· 362 362 * @ns: namespace the new file should belong to 363 363 */ 364 364 int sysfs_create_file_ns(struct kobject *kobj, const struct attribute *attr, 365 - const void *ns) 365 + const struct ns_common *ns) 366 366 { 367 367 kuid_t uid; 368 368 kgid_t gid; ··· 505 505 * Hash the attribute name and namespace tag and kill the victim. 506 506 */ 507 507 void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, 508 - const void *ns) 508 + const struct ns_common *ns) 509 509 { 510 510 struct kernfs_node *parent = kobj->sd; 511 511
+6 -4
fs/sysfs/mount.c
··· 55 55 static int sysfs_init_fs_context(struct fs_context *fc) 56 56 { 57 57 struct kernfs_fs_context *kfc; 58 - struct net *netns; 58 + struct ns_common *ns; 59 59 60 60 if (!(fc->sb_flags & SB_KERNMOUNT)) { 61 61 if (!kobj_ns_current_may_mount(KOBJ_NS_TYPE_NET)) ··· 66 66 if (!kfc) 67 67 return -ENOMEM; 68 68 69 - kfc->ns_tag = netns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); 69 + kfc->ns_tag = ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); 70 70 kfc->root = sysfs_root; 71 71 kfc->magic = SYSFS_MAGIC; 72 72 fc->fs_private = kfc; 73 73 fc->ops = &sysfs_fs_context_ops; 74 - if (netns) { 74 + if (ns) { 75 + struct net *netns = to_net_ns(ns); 76 + 75 77 put_user_ns(fc->user_ns); 76 78 fc->user_ns = get_user_ns(netns->user_ns); 77 79 } ··· 83 81 84 82 static void sysfs_kill_sb(struct super_block *sb) 85 83 { 86 - void *ns = (void *)kernfs_super_ns(sb); 84 + struct ns_common *ns = (struct ns_common *)kernfs_super_ns(sb); 87 85 88 86 kernfs_kill_sb(sb); 89 87 kobj_ns_drop(KOBJ_NS_TYPE_NET, ns);
+4 -3
fs/sysfs/symlink.c
··· 121 121 void sysfs_delete_link(struct kobject *kobj, struct kobject *targ, 122 122 const char *name) 123 123 { 124 - const void *ns = NULL; 124 + const struct ns_common *ns = NULL; 125 125 126 126 /* 127 127 * We don't own @target and it may be removed at any time. ··· 164 164 * A helper function for the common rename symlink idiom. 165 165 */ 166 166 int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *targ, 167 - const char *old, const char *new, const void *new_ns) 167 + const char *old, const char *new, 168 + const struct ns_common *new_ns) 168 169 { 169 170 struct kernfs_node *parent, *kn = NULL; 170 - const void *old_ns = NULL; 171 + const struct ns_common *old_ns = NULL; 171 172 int result; 172 173 173 174 if (!kobj)
+2 -2
fs/sysfs/sysfs.h
··· 29 29 */ 30 30 int sysfs_add_file_mode_ns(struct kernfs_node *parent, 31 31 const struct attribute *attr, umode_t amode, kuid_t uid, 32 - kgid_t gid, const void *ns); 32 + kgid_t gid, const struct ns_common *ns); 33 33 int sysfs_add_bin_file_mode_ns(struct kernfs_node *parent, 34 34 const struct bin_attribute *battr, umode_t mode, size_t size, 35 - kuid_t uid, kgid_t gid, const void *ns); 35 + kuid_t uid, kgid_t gid, const struct ns_common *ns); 36 36 37 37 /* 38 38 * symlink.c
+3 -3
include/linux/device/class.h
··· 62 62 int (*shutdown_pre)(struct device *dev); 63 63 64 64 const struct kobj_ns_type_operations *ns_type; 65 - const void *(*namespace)(const struct device *dev); 65 + const struct ns_common *(*namespace)(const struct device *dev); 66 66 67 67 void (*get_ownership)(const struct device *dev, kuid_t *uid, kgid_t *gid); 68 68 ··· 180 180 struct class_attribute class_attr_##_name = __ATTR_WO(_name) 181 181 182 182 int __must_check class_create_file_ns(const struct class *class, const struct class_attribute *attr, 183 - const void *ns); 183 + const struct ns_common *ns); 184 184 void class_remove_file_ns(const struct class *class, const struct class_attribute *attr, 185 - const void *ns); 185 + const struct ns_common *ns); 186 186 187 187 static inline int __must_check class_create_file(const struct class *class, 188 188 const struct class_attribute *attr)
+24 -16
include/linux/kernfs.h
··· 23 23 struct file; 24 24 struct dentry; 25 25 struct iattr; 26 + struct ns_common; 26 27 struct seq_file; 27 28 struct vm_area_struct; 28 29 struct vm_operations_struct; ··· 210 209 211 210 struct rb_node rb; 212 211 213 - const void *ns; /* namespace tag */ 212 + const struct ns_common *ns; /* namespace tag */ 214 213 unsigned int hash; /* ns + name hash */ 215 214 unsigned short flags; 216 215 umode_t mode; ··· 332 331 */ 333 332 struct kernfs_fs_context { 334 333 struct kernfs_root *root; /* Root of the hierarchy being mounted */ 335 - void *ns_tag; /* Namespace tag of the mount (or NULL) */ 334 + struct ns_common *ns_tag; /* Namespace tag of the mount (or NULL) */ 336 335 unsigned long magic; /* File system specific magic number */ 337 336 338 337 /* The following are set/used by kernfs_mount() */ ··· 407 406 void pr_cont_kernfs_path(struct kernfs_node *kn); 408 407 struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn); 409 408 struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent, 410 - const char *name, const void *ns); 409 + const char *name, 410 + const struct ns_common *ns); 411 411 struct kernfs_node *kernfs_walk_and_get_ns(struct kernfs_node *parent, 412 - const char *path, const void *ns); 412 + const char *path, 413 + const struct ns_common *ns); 413 414 void kernfs_get(struct kernfs_node *kn); 414 415 void kernfs_put(struct kernfs_node *kn); 415 416 ··· 429 426 struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, 430 427 const char *name, umode_t mode, 431 428 kuid_t uid, kgid_t gid, 432 - void *priv, const void *ns); 429 + void *priv, 430 + const struct ns_common *ns); 433 431 struct kernfs_node *kernfs_create_empty_dir(struct kernfs_node *parent, 434 432 const char *name); 435 433 struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent, ··· 438 434 kuid_t uid, kgid_t gid, 439 435 loff_t size, 440 436 const struct kernfs_ops *ops, 441 - void *priv, const void *ns, 437 + void *priv, 438 + const struct ns_common *ns, 442 439 struct lock_class_key *key); 443 440 struct kernfs_node *kernfs_create_link(struct kernfs_node *parent, 444 441 const char *name, ··· 451 446 void kernfs_unbreak_active_protection(struct kernfs_node *kn); 452 447 bool kernfs_remove_self(struct kernfs_node *kn); 453 448 int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, 454 - const void *ns); 449 + const struct ns_common *ns); 455 450 int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent, 456 - const char *new_name, const void *new_ns); 451 + const char *new_name, const struct ns_common *new_ns); 457 452 int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr); 458 453 __poll_t kernfs_generic_poll(struct kernfs_open_file *of, 459 454 struct poll_table_struct *pt); ··· 464 459 int kernfs_xattr_set(struct kernfs_node *kn, const char *name, 465 460 const void *value, size_t size, int flags); 466 461 467 - const void *kernfs_super_ns(struct super_block *sb); 462 + const struct ns_common *kernfs_super_ns(struct super_block *sb); 468 463 int kernfs_get_tree(struct fs_context *fc); 469 464 void kernfs_free_fs_context(struct fs_context *fc); 470 465 void kernfs_kill_sb(struct super_block *sb); ··· 499 494 500 495 static inline struct kernfs_node * 501 496 kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name, 502 - const void *ns) 497 + const struct ns_common *ns) 503 498 { return NULL; } 504 499 static inline struct kernfs_node * 505 500 kernfs_walk_and_get_ns(struct kernfs_node *parent, const char *path, 506 - const void *ns) 501 + const struct ns_common *ns) 507 502 { return NULL; } 508 503 509 504 static inline void kernfs_get(struct kernfs_node *kn) { } ··· 531 526 static inline struct kernfs_node * 532 527 kernfs_create_dir_ns(struct kernfs_node *parent, const char *name, 533 528 umode_t mode, kuid_t uid, kgid_t gid, 534 - void *priv, const void *ns) 529 + void *priv, const struct ns_common *ns) 535 530 { return ERR_PTR(-ENOSYS); } 536 531 537 532 static inline struct kernfs_node * 538 533 __kernfs_create_file(struct kernfs_node *parent, const char *name, 539 534 umode_t mode, kuid_t uid, kgid_t gid, 540 535 loff_t size, const struct kernfs_ops *ops, 541 - void *priv, const void *ns, struct lock_class_key *key) 536 + void *priv, const struct ns_common *ns, 537 + struct lock_class_key *key) 542 538 { return ERR_PTR(-ENOSYS); } 543 539 544 540 static inline struct kernfs_node * ··· 555 549 { return false; } 556 550 557 551 static inline int kernfs_remove_by_name_ns(struct kernfs_node *kn, 558 - const char *name, const void *ns) 552 + const char *name, 553 + const struct ns_common *ns) 559 554 { return -ENOSYS; } 560 555 561 556 static inline int kernfs_rename_ns(struct kernfs_node *kn, 562 557 struct kernfs_node *new_parent, 563 - const char *new_name, const void *new_ns) 558 + const char *new_name, 559 + const struct ns_common *new_ns) 564 560 { return -ENOSYS; } 565 561 566 562 static inline int kernfs_setattr(struct kernfs_node *kn, ··· 583 575 const void *value, size_t size, int flags) 584 576 { return -ENOSYS; } 585 577 586 - static inline const void *kernfs_super_ns(struct super_block *sb) 578 + static inline const struct ns_common *kernfs_super_ns(struct super_block *sb) 587 579 { return NULL; } 588 580 589 581 static inline int kernfs_get_tree(struct fs_context *fc)
+2 -2
include/linux/kobject.h
··· 109 109 struct kobject * __must_check kobject_get_unless_zero(struct kobject *kobj); 110 110 void kobject_put(struct kobject *kobj); 111 111 112 - const void *kobject_namespace(const struct kobject *kobj); 112 + const struct ns_common *kobject_namespace(const struct kobject *kobj); 113 113 void kobject_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t *gid); 114 114 char *kobject_get_path(const struct kobject *kobj, gfp_t flag); 115 115 ··· 118 118 const struct sysfs_ops *sysfs_ops; 119 119 const struct attribute_group **default_groups; 120 120 const struct kobj_ns_type_operations *(*child_ns_type)(const struct kobject *kobj); 121 - const void *(*namespace)(const struct kobject *kobj); 121 + const struct ns_common *(*namespace)(const struct kobject *kobj); 122 122 void (*get_ownership)(const struct kobject *kobj, kuid_t *uid, kgid_t *gid); 123 123 }; 124 124
+7 -6
include/linux/kobject_ns.h
··· 16 16 #ifndef _LINUX_KOBJECT_NS_H 17 17 #define _LINUX_KOBJECT_NS_H 18 18 19 + struct ns_common; 19 20 struct sock; 20 21 struct kobject; 21 22 ··· 40 39 struct kobj_ns_type_operations { 41 40 enum kobj_ns_type type; 42 41 bool (*current_may_mount)(void); 43 - void *(*grab_current_ns)(void); 44 - const void *(*netlink_ns)(struct sock *sk); 45 - const void *(*initial_ns)(void); 46 - void (*drop_ns)(void *); 42 + struct ns_common *(*grab_current_ns)(void); 43 + const struct ns_common *(*netlink_ns)(struct sock *sk); 44 + const struct ns_common *(*initial_ns)(void); 45 + void (*drop_ns)(struct ns_common *); 47 46 }; 48 47 49 48 int kobj_ns_type_register(const struct kobj_ns_type_operations *ops); ··· 52 51 const struct kobj_ns_type_operations *kobj_ns_ops(const struct kobject *kobj); 53 52 54 53 bool kobj_ns_current_may_mount(enum kobj_ns_type type); 55 - void *kobj_ns_grab_current(enum kobj_ns_type type); 56 - void kobj_ns_drop(enum kobj_ns_type type, void *ns); 54 + struct ns_common *kobj_ns_grab_current(enum kobj_ns_type type); 55 + void kobj_ns_drop(enum kobj_ns_type type, struct ns_common *ns); 57 56 58 57 #endif /* _LINUX_KOBJECT_NS_H */
+2 -2
include/linux/netdevice.h
··· 5339 5339 } 5340 5340 5341 5341 int netdev_class_create_file_ns(const struct class_attribute *class_attr, 5342 - const void *ns); 5342 + const struct ns_common *ns); 5343 5343 void netdev_class_remove_file_ns(const struct class_attribute *class_attr, 5344 - const void *ns); 5344 + const struct ns_common *ns); 5345 5345 5346 5346 extern const struct kobj_ns_type_operations net_ns_type_operations; 5347 5347
+12 -12
include/linux/sysfs.h
··· 396 396 397 397 #ifdef CONFIG_SYSFS 398 398 399 - int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns); 399 + int __must_check sysfs_create_dir_ns(struct kobject *kobj, const struct ns_common *ns); 400 400 void sysfs_remove_dir(struct kobject *kobj); 401 401 int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name, 402 - const void *new_ns); 402 + const struct ns_common *new_ns); 403 403 int __must_check sysfs_move_dir_ns(struct kobject *kobj, 404 404 struct kobject *new_parent_kobj, 405 - const void *new_ns); 405 + const struct ns_common *new_ns); 406 406 int __must_check sysfs_create_mount_point(struct kobject *parent_kobj, 407 407 const char *name); 408 408 void sysfs_remove_mount_point(struct kobject *parent_kobj, ··· 410 410 411 411 int __must_check sysfs_create_file_ns(struct kobject *kobj, 412 412 const struct attribute *attr, 413 - const void *ns); 413 + const struct ns_common *ns); 414 414 int __must_check sysfs_create_files(struct kobject *kobj, 415 415 const struct attribute * const *attr); 416 416 int __must_check sysfs_chmod_file(struct kobject *kobj, ··· 419 419 const struct attribute *attr); 420 420 void sysfs_unbreak_active_protection(struct kernfs_node *kn); 421 421 void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, 422 - const void *ns); 422 + const struct ns_common *ns); 423 423 bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr); 424 424 void sysfs_remove_files(struct kobject *kobj, const struct attribute * const *attr); 425 425 ··· 437 437 438 438 int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *target, 439 439 const char *old_name, const char *new_name, 440 - const void *new_ns); 440 + const struct ns_common *new_ns); 441 441 442 442 void sysfs_delete_link(struct kobject *dir, struct kobject *targ, 443 443 const char *name); ··· 502 502 503 503 #else /* CONFIG_SYSFS */ 504 504 505 - static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) 505 + static inline int sysfs_create_dir_ns(struct kobject *kobj, const struct ns_common *ns) 506 506 { 507 507 return 0; 508 508 } ··· 512 512 } 513 513 514 514 static inline int sysfs_rename_dir_ns(struct kobject *kobj, 515 - const char *new_name, const void *new_ns) 515 + const char *new_name, const struct ns_common *new_ns) 516 516 { 517 517 return 0; 518 518 } 519 519 520 520 static inline int sysfs_move_dir_ns(struct kobject *kobj, 521 521 struct kobject *new_parent_kobj, 522 - const void *new_ns) 522 + const struct ns_common *new_ns) 523 523 { 524 524 return 0; 525 525 } ··· 537 537 538 538 static inline int sysfs_create_file_ns(struct kobject *kobj, 539 539 const struct attribute *attr, 540 - const void *ns) 540 + const struct ns_common *ns) 541 541 { 542 542 return 0; 543 543 } ··· 567 567 568 568 static inline void sysfs_remove_file_ns(struct kobject *kobj, 569 569 const struct attribute *attr, 570 - const void *ns) 570 + const struct ns_common *ns) 571 571 { 572 572 } 573 573 ··· 612 612 613 613 static inline int sysfs_rename_link_ns(struct kobject *k, struct kobject *t, 614 614 const char *old_name, 615 - const char *new_name, const void *ns) 615 + const char *new_name, const struct ns_common *ns) 616 616 { 617 617 return 0; 618 618 }
+4 -4
include/net/net_namespace.h
··· 264 264 #define ipx_unregister_sysctl() 265 265 #endif 266 266 267 - #ifdef CONFIG_NET_NS 268 - void __put_net(struct net *net); 269 - 270 267 static inline struct net *to_net_ns(struct ns_common *ns) 271 268 { 272 269 return container_of(ns, struct net, ns); 273 270 } 271 + 272 + #ifdef CONFIG_NET_NS 273 + void __put_net(struct net *net); 274 274 275 275 /* Try using get_net_track() instead */ 276 276 static inline struct net *get_net(struct net *net) ··· 309 309 return ns_ref_read(net) != 0; 310 310 } 311 311 312 - void net_drop_ns(void *); 312 + void net_drop_ns(struct ns_common *); 313 313 void net_passive_dec(struct net *net); 314 314 315 315 #else
+4 -4
lib/kobject.c
··· 27 27 * and thus @kobj should have a namespace tag associated with it. Returns 28 28 * %NULL otherwise. 29 29 */ 30 - const void *kobject_namespace(const struct kobject *kobj) 30 + const struct ns_common *kobject_namespace(const struct kobject *kobj) 31 31 { 32 32 const struct kobj_ns_type_operations *ns_ops = kobj_ns_ops(kobj); 33 33 ··· 1083 1083 return may_mount; 1084 1084 } 1085 1085 1086 - void *kobj_ns_grab_current(enum kobj_ns_type type) 1086 + struct ns_common *kobj_ns_grab_current(enum kobj_ns_type type) 1087 1087 { 1088 - void *ns = NULL; 1088 + struct ns_common *ns = NULL; 1089 1089 1090 1090 spin_lock(&kobj_ns_type_lock); 1091 1091 if (kobj_ns_type_is_valid(type) && kobj_ns_ops_tbl[type]) ··· 1096 1096 } 1097 1097 EXPORT_SYMBOL_GPL(kobj_ns_grab_current); 1098 1098 1099 - void kobj_ns_drop(enum kobj_ns_type type, void *ns) 1099 + void kobj_ns_drop(enum kobj_ns_type type, struct ns_common *ns) 1100 1100 { 1101 1101 spin_lock(&kobj_ns_type_lock); 1102 1102 if (kobj_ns_type_is_valid(type) &&
+8 -5
lib/kobject_uevent.c
··· 238 238 239 239 ops = kobj_ns_ops(kobj); 240 240 if (ops) { 241 - const void *init_ns, *ns; 241 + const struct ns_common *init_ns, *ns; 242 242 243 243 ns = kobj->ktype->namespace(kobj); 244 244 init_ns = ops->initial_ns(); ··· 388 388 389 389 #ifdef CONFIG_NET 390 390 const struct kobj_ns_type_operations *ops; 391 - const struct net *net = NULL; 391 + const struct ns_common *ns = NULL; 392 392 393 393 ops = kobj_ns_ops(kobj); 394 394 if (!ops && kobj->kset) { ··· 404 404 */ 405 405 if (ops && ops->netlink_ns && kobj->ktype->namespace) 406 406 if (ops->type == KOBJ_NS_TYPE_NET) 407 - net = kobj->ktype->namespace(kobj); 407 + ns = kobj->ktype->namespace(kobj); 408 408 409 - if (!net) 409 + if (!ns) 410 410 ret = uevent_net_broadcast_untagged(env, action_string, 411 411 devpath); 412 - else 412 + else { 413 + const struct net *net = container_of(ns, struct net, ns); 414 + 413 415 ret = uevent_net_broadcast_tagged(net->uevent_sock->sk, env, 414 416 action_string, devpath); 417 + } 415 418 #endif 416 419 417 420 return ret;
+25 -25
net/core/net-sysfs.c
··· 1181 1181 netdev_put(queue->dev, &queue->dev_tracker); 1182 1182 } 1183 1183 1184 - static const void *rx_queue_namespace(const struct kobject *kobj) 1184 + static const struct ns_common *rx_queue_namespace(const struct kobject *kobj) 1185 1185 { 1186 1186 struct netdev_rx_queue *queue = to_rx_queue(kobj); 1187 1187 struct device *dev = &queue->dev->dev; 1188 - const void *ns = NULL; 1189 1188 1190 1189 if (dev->class && dev->class->namespace) 1191 - ns = dev->class->namespace(dev); 1190 + return dev->class->namespace(dev); 1192 1191 1193 - return ns; 1192 + return NULL; 1194 1193 } 1195 1194 1196 1195 static void rx_queue_get_ownership(const struct kobject *kobj, 1197 1196 kuid_t *uid, kgid_t *gid) 1198 1197 { 1199 - const struct net *net = rx_queue_namespace(kobj); 1198 + const struct ns_common *ns = rx_queue_namespace(kobj); 1200 1199 1201 - net_ns_get_ownership(net, uid, gid); 1200 + net_ns_get_ownership(ns ? container_of(ns, struct net, ns) : NULL, 1201 + uid, gid); 1202 1202 } 1203 1203 1204 1204 static const struct kobj_type rx_queue_ktype = { ··· 1931 1931 netdev_put(queue->dev, &queue->dev_tracker); 1932 1932 } 1933 1933 1934 - static const void *netdev_queue_namespace(const struct kobject *kobj) 1934 + static const struct ns_common *netdev_queue_namespace(const struct kobject *kobj) 1935 1935 { 1936 1936 struct netdev_queue *queue = to_netdev_queue(kobj); 1937 1937 struct device *dev = &queue->dev->dev; 1938 - const void *ns = NULL; 1939 1938 1940 1939 if (dev->class && dev->class->namespace) 1941 - ns = dev->class->namespace(dev); 1940 + return dev->class->namespace(dev); 1942 1941 1943 - return ns; 1942 + return NULL; 1944 1943 } 1945 1944 1946 1945 static void netdev_queue_get_ownership(const struct kobject *kobj, 1947 1946 kuid_t *uid, kgid_t *gid) 1948 1947 { 1949 - const struct net *net = netdev_queue_namespace(kobj); 1948 + const struct ns_common *ns = netdev_queue_namespace(kobj); 1950 1949 1951 - net_ns_get_ownership(net, uid, gid); 1950 + net_ns_get_ownership(ns ? container_of(ns, struct net, ns) : NULL, 1951 + uid, gid); 1952 1952 } 1953 1953 1954 1954 static const struct kobj_type netdev_queue_ktype = { ··· 2185 2185 return ns_capable(net->user_ns, CAP_SYS_ADMIN); 2186 2186 } 2187 2187 2188 - static void *net_grab_current_ns(void) 2188 + static struct ns_common *net_grab_current_ns(void) 2189 2189 { 2190 - struct net *ns = current->nsproxy->net_ns; 2190 + struct net *net = current->nsproxy->net_ns; 2191 2191 #ifdef CONFIG_NET_NS 2192 - if (ns) 2193 - refcount_inc(&ns->passive); 2192 + if (net) 2193 + refcount_inc(&net->passive); 2194 2194 #endif 2195 - return ns; 2195 + return net ? to_ns_common(net) : NULL; 2196 2196 } 2197 2197 2198 - static const void *net_initial_ns(void) 2198 + static const struct ns_common *net_initial_ns(void) 2199 2199 { 2200 - return &init_net; 2200 + return to_ns_common(&init_net); 2201 2201 } 2202 2202 2203 - static const void *net_netlink_ns(struct sock *sk) 2203 + static const struct ns_common *net_netlink_ns(struct sock *sk) 2204 2204 { 2205 - return sock_net(sk); 2205 + return to_ns_common(sock_net(sk)); 2206 2206 } 2207 2207 2208 2208 const struct kobj_ns_type_operations net_ns_type_operations = { ··· 2252 2252 kvfree(dev); 2253 2253 } 2254 2254 2255 - static const void *net_namespace(const struct device *d) 2255 + static const struct ns_common *net_namespace(const struct device *d) 2256 2256 { 2257 2257 const struct net_device *dev = to_net_dev(d); 2258 2258 2259 - return dev_net(dev); 2259 + return to_ns_common(dev_net(dev)); 2260 2260 } 2261 2261 2262 2262 static void net_get_ownership(const struct device *d, kuid_t *uid, kgid_t *gid) ··· 2402 2402 } 2403 2403 2404 2404 int netdev_class_create_file_ns(const struct class_attribute *class_attr, 2405 - const void *ns) 2405 + const struct ns_common *ns) 2406 2406 { 2407 2407 return class_create_file_ns(&net_class, class_attr, ns); 2408 2408 } 2409 2409 EXPORT_SYMBOL(netdev_class_create_file_ns); 2410 2410 2411 2411 void netdev_class_remove_file_ns(const struct class_attribute *class_attr, 2412 - const void *ns) 2412 + const struct ns_common *ns) 2413 2413 { 2414 2414 class_remove_file_ns(&net_class, class_attr, ns); 2415 2415 }
+3 -5
net/core/net_namespace.c
··· 540 540 } 541 541 } 542 542 543 - void net_drop_ns(void *p) 543 + void net_drop_ns(struct ns_common *ns) 544 544 { 545 - struct net *net = (struct net *)p; 546 - 547 - if (net) 548 - net_passive_dec(net); 545 + if (ns) 546 + net_passive_dec(to_net_ns(ns)); 549 547 } 550 548 551 549 struct net *copy_net_ns(u64 flags,
+10 -7
net/sunrpc/sysfs.c
··· 6 6 #include <linux/kobject.h> 7 7 #include <linux/sunrpc/addr.h> 8 8 #include <linux/sunrpc/xprtsock.h> 9 + #include <net/net_namespace.h> 9 10 10 11 #include "sysfs.h" 11 12 ··· 554 553 kfree(xprt); 555 554 } 556 555 557 - static const void *rpc_sysfs_client_namespace(const struct kobject *kobj) 556 + static const struct ns_common *rpc_sysfs_client_namespace(const struct kobject *kobj) 558 557 { 559 - return container_of(kobj, struct rpc_sysfs_client, kobject)->net; 558 + return to_ns_common(container_of(kobj, struct rpc_sysfs_client, 559 + kobject)->net); 560 560 } 561 561 562 - static const void *rpc_sysfs_xprt_switch_namespace(const struct kobject *kobj) 562 + static const struct ns_common *rpc_sysfs_xprt_switch_namespace(const struct kobject *kobj) 563 563 { 564 - return container_of(kobj, struct rpc_sysfs_xprt_switch, kobject)->net; 564 + return to_ns_common(container_of(kobj, struct rpc_sysfs_xprt_switch, 565 + kobject)->net); 565 566 } 566 567 567 - static const void *rpc_sysfs_xprt_namespace(const struct kobject *kobj) 568 + static const struct ns_common *rpc_sysfs_xprt_namespace(const struct kobject *kobj) 568 569 { 569 - return container_of(kobj, struct rpc_sysfs_xprt, 570 - kobject)->xprt->xprt_net; 570 + return to_ns_common(container_of(kobj, struct rpc_sysfs_xprt, 571 + kobject)->xprt->xprt_net); 571 572 } 572 573 573 574 static struct kobj_attribute rpc_sysfs_clnt_version = __ATTR(rpc_version,
+2 -2
net/wireless/sysfs.c
··· 154 154 #define WIPHY_PM_OPS NULL 155 155 #endif 156 156 157 - static const void *wiphy_namespace(const struct device *d) 157 + static const struct ns_common *wiphy_namespace(const struct device *d) 158 158 { 159 159 struct wiphy *wiphy = container_of(d, struct wiphy, dev); 160 160 161 - return wiphy_net(wiphy); 161 + return to_ns_common(wiphy_net(wiphy)); 162 162 } 163 163 164 164 struct class ieee80211_class = {