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

Pull driver core fixes from Greg KH:
"Here are some small driver core and debugfs fixes for 6.0-rc5.

Included in here are:

- multiple attempts to get the arch_topology code to work properly on
non-cluster SMT systems. First attempt caused build breakages in
linux-next and 0-day, second try worked.

- debugfs fixes for a long-suffering memory leak. The pattern of
debugfs_remove(debugfs_lookup(...)) turns out to leak dentries, so
add debugfs_lookup_and_remove() to fix this problem. Also fix up
the scheduler debug code that highlighted this problem. Fixes for
other subsystems will be trickling in over the next few months for
this same issue once the debugfs function is merged.

All of these have been in linux-next since Wednesday with no reported
problems"

* tag 'driver-core-6.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
arch_topology: Make cluster topology span at least SMT CPUs
sched/debug: fix dentry leak in update_sched_domain_debugfs
debugfs: add debugfs_lookup_and_remove()
driver core: fix driver_set_override() issue with empty strings
Revert "arch_topology: Make cluster topology span at least SMT CPUs"
arch_topology: Make cluster topology span at least SMT CPUs

+36 -2
+1 -1
drivers/base/arch_topology.c
··· 724 724 */ 725 725 if (cpumask_subset(cpu_coregroup_mask(cpu), 726 726 &cpu_topology[cpu].cluster_sibling)) 727 - return get_cpu_mask(cpu); 727 + return topology_sibling_cpumask(cpu); 728 728 729 729 return &cpu_topology[cpu].cluster_sibling; 730 730 }
+6
drivers/base/driver.c
··· 63 63 if (len >= (PAGE_SIZE - 1)) 64 64 return -EINVAL; 65 65 66 + /* 67 + * Compute the real length of the string in case userspace sends us a 68 + * bunch of \0 characters like python likes to do. 69 + */ 70 + len = strlen(s); 71 + 66 72 if (!len) { 67 73 /* Empty string passed - clear override */ 68 74 device_lock(dev);
+22
fs/debugfs/inode.c
··· 745 745 EXPORT_SYMBOL_GPL(debugfs_remove); 746 746 747 747 /** 748 + * debugfs_lookup_and_remove - lookup a directory or file and recursively remove it 749 + * @name: a pointer to a string containing the name of the item to look up. 750 + * @parent: a pointer to the parent dentry of the item. 751 + * 752 + * This is the equlivant of doing something like 753 + * debugfs_remove(debugfs_lookup(..)) but with the proper reference counting 754 + * handled for the directory being looked up. 755 + */ 756 + void debugfs_lookup_and_remove(const char *name, struct dentry *parent) 757 + { 758 + struct dentry *dentry; 759 + 760 + dentry = debugfs_lookup(name, parent); 761 + if (!dentry) 762 + return; 763 + 764 + debugfs_remove(dentry); 765 + dput(dentry); 766 + } 767 + EXPORT_SYMBOL_GPL(debugfs_lookup_and_remove); 768 + 769 + /** 748 770 * debugfs_rename - rename a file/directory in the debugfs filesystem 749 771 * @old_dir: a pointer to the parent dentry for the renamed object. This 750 772 * should be a directory dentry.
+6
include/linux/debugfs.h
··· 91 91 void debugfs_remove(struct dentry *dentry); 92 92 #define debugfs_remove_recursive debugfs_remove 93 93 94 + void debugfs_lookup_and_remove(const char *name, struct dentry *parent); 95 + 94 96 const struct file_operations *debugfs_real_fops(const struct file *filp); 95 97 96 98 int debugfs_file_get(struct dentry *dentry); ··· 225 223 { } 226 224 227 225 static inline void debugfs_remove_recursive(struct dentry *dentry) 226 + { } 227 + 228 + static inline void debugfs_lookup_and_remove(const char *name, 229 + struct dentry *parent) 228 230 { } 229 231 230 232 const struct file_operations *debugfs_real_fops(const struct file *filp);
+1 -1
kernel/sched/debug.c
··· 416 416 char buf[32]; 417 417 418 418 snprintf(buf, sizeof(buf), "cpu%d", cpu); 419 - debugfs_remove(debugfs_lookup(buf, sd_dentry)); 419 + debugfs_lookup_and_remove(buf, sd_dentry); 420 420 d_cpu = debugfs_create_dir(buf, sd_dentry); 421 421 422 422 i = 0;