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 'driver-core-3.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull sysfs fix from Greg KH:
"Here is a single sysfs fix for 3.14-rc5. It fixes a reported problem
with the namespace code in sysfs"

* tag 'driver-core-3.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
sysfs: fix namespace refcnt leak

+15 -7
+7 -1
fs/kernfs/mount.c
··· 94 94 * @fs_type: file_system_type of the fs being mounted 95 95 * @flags: mount flags specified for the mount 96 96 * @root: kernfs_root of the hierarchy being mounted 97 + * @new_sb_created: tell the caller if we allocated a new superblock 97 98 * @ns: optional namespace tag of the mount 98 99 * 99 100 * This is to be called from each kernfs user's file_system_type->mount() ··· 105 104 * The return value can be passed to the vfs layer verbatim. 106 105 */ 107 106 struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, 108 - struct kernfs_root *root, const void *ns) 107 + struct kernfs_root *root, bool *new_sb_created, 108 + const void *ns) 109 109 { 110 110 struct super_block *sb; 111 111 struct kernfs_super_info *info; ··· 124 122 kfree(info); 125 123 if (IS_ERR(sb)) 126 124 return ERR_CAST(sb); 125 + 126 + if (new_sb_created) 127 + *new_sb_created = !sb->s_root; 128 + 127 129 if (!sb->s_root) { 128 130 error = kernfs_fill_super(sb); 129 131 if (error) {
+3 -2
fs/sysfs/mount.c
··· 27 27 { 28 28 struct dentry *root; 29 29 void *ns; 30 + bool new_sb; 30 31 31 32 if (!(flags & MS_KERNMOUNT)) { 32 33 if (!capable(CAP_SYS_ADMIN) && !fs_fully_visible(fs_type)) ··· 38 37 } 39 38 40 39 ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET); 41 - root = kernfs_mount_ns(fs_type, flags, sysfs_root, ns); 42 - if (IS_ERR(root)) 40 + root = kernfs_mount_ns(fs_type, flags, sysfs_root, &new_sb, ns); 41 + if (IS_ERR(root) || !new_sb) 43 42 kobj_ns_drop(KOBJ_NS_TYPE_NET, ns); 44 43 return root; 45 44 }
+5 -4
include/linux/kernfs.h
··· 249 249 250 250 const void *kernfs_super_ns(struct super_block *sb); 251 251 struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags, 252 - struct kernfs_root *root, const void *ns); 252 + struct kernfs_root *root, bool *new_sb_created, 253 + const void *ns); 253 254 void kernfs_kill_sb(struct super_block *sb); 254 255 255 256 void kernfs_init(void); ··· 318 317 319 318 static inline struct dentry * 320 319 kernfs_mount_ns(struct file_system_type *fs_type, int flags, 321 - struct kernfs_root *root, const void *ns) 320 + struct kernfs_root *root, bool *new_sb_created, const void *ns) 322 321 { return ERR_PTR(-ENOSYS); } 323 322 324 323 static inline void kernfs_kill_sb(struct super_block *sb) { } ··· 369 368 370 369 static inline struct dentry * 371 370 kernfs_mount(struct file_system_type *fs_type, int flags, 372 - struct kernfs_root *root) 371 + struct kernfs_root *root, bool *new_sb_created) 373 372 { 374 - return kernfs_mount_ns(fs_type, flags, root, NULL); 373 + return kernfs_mount_ns(fs_type, flags, root, new_sb_created, NULL); 375 374 } 376 375 377 376 #endif /* __LINUX_KERNFS_H */