Commit 3d71f86f4dfccd749e4421f10301f3f3b31da88a
Committed by
Linus Torvalds
1 parent
6a6375db13
Exists in
master
and in
20 other branches
mm: use non-racy method for /proc/swaps creation
Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to main tree. Signed-off-by: Denis V. Lunev <den@openvz.org> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 1 additions and 5 deletions Side-by-side Diff
mm/swapfile.c
... | ... | @@ -1426,11 +1426,7 @@ |
1426 | 1426 | |
1427 | 1427 | static int __init procswaps_init(void) |
1428 | 1428 | { |
1429 | - struct proc_dir_entry *entry; | |
1430 | - | |
1431 | - entry = create_proc_entry("swaps", 0, NULL); | |
1432 | - if (entry) | |
1433 | - entry->proc_fops = &proc_swaps_operations; | |
1429 | + proc_create("swaps", 0, NULL, &proc_swaps_operations); | |
1434 | 1430 | return 0; |
1435 | 1431 | } |
1436 | 1432 | __initcall(procswaps_init); |