diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 0da2b2635c54..5e220bf7d4c4 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -5272,11 +5272,20 @@ static struct ctl_table *sd_alloc_ctl_entry(int n) | |||
5272 | 5272 | ||
5273 | static void sd_free_ctl_entry(struct ctl_table **tablep) | 5273 | static void sd_free_ctl_entry(struct ctl_table **tablep) |
5274 | { | 5274 | { |
5275 | struct ctl_table *entry = *tablep; | 5275 | struct ctl_table *entry; |
5276 | 5276 | ||
5277 | for (entry = *tablep; entry->procname; entry++) | 5277 | /* |
5278 | * In the intermediate directories, both the child directory and | ||
5279 | * procname are dynamically allocated and could fail but the mode | ||
5280 | * will always be set. In the lowest directory the names are | ||
5281 | * static strings and all have proc handlers. | ||
5282 | */ | ||
5283 | for (entry = *tablep; entry->mode; entry++) { | ||
5278 | if (entry->child) | 5284 | if (entry->child) |
5279 | sd_free_ctl_entry(&entry->child); | 5285 | sd_free_ctl_entry(&entry->child); |
5286 | if (entry->proc_handler == NULL) | ||
5287 | kfree(entry->procname); | ||
5288 | } | ||
5280 | 5289 | ||
5281 | kfree(*tablep); | 5290 | kfree(*tablep); |
5282 | *tablep = NULL; | 5291 | *tablep = NULL; |