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

usb: use non-racy method for proc entries creation

Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data
be setup before gluing PDE to main tree.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
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>

authored by

Denis V. Lunev and committed by
Linus Torvalds
cdefa185 a973909f

+5 -23
+2 -9
drivers/usb/gadget/at91_udc.c
··· 231 231 } 232 232 233 233 static const struct file_operations proc_ops = { 234 + .owner = THIS_MODULE, 234 235 .open = proc_udc_open, 235 236 .read = seq_read, 236 237 .llseek = seq_lseek, ··· 240 239 241 240 static void create_debug_file(struct at91_udc *udc) 242 241 { 243 - struct proc_dir_entry *pde; 244 - 245 - pde = create_proc_entry (debug_filename, 0, NULL); 246 - udc->pde = pde; 247 - if (pde == NULL) 248 - return; 249 - 250 - pde->proc_fops = &proc_ops; 251 - pde->data = udc; 242 + udc->pde = proc_create_data(debug_filename, 0, NULL, &proc_ops, udc); 252 243 } 253 244 254 245 static void remove_debug_file(struct at91_udc *udc)
+2 -5
drivers/usb/gadget/omap_udc.c
··· 2504 2504 } 2505 2505 2506 2506 static const struct file_operations proc_ops = { 2507 + .owner = THIS_MODULE, 2507 2508 .open = proc_udc_open, 2508 2509 .read = seq_read, 2509 2510 .llseek = seq_lseek, ··· 2513 2512 2514 2513 static void create_proc_file(void) 2515 2514 { 2516 - struct proc_dir_entry *pde; 2517 - 2518 - pde = create_proc_entry (proc_filename, 0, NULL); 2519 - if (pde) 2520 - pde->proc_fops = &proc_ops; 2515 + proc_create(proc_filename, 0, NULL, &proc_ops); 2521 2516 } 2522 2517 2523 2518 static void remove_proc_file(void)
+1 -9
drivers/usb/host/sl811-hcd.c
··· 1506 1506 1507 1507 static void create_debug_file(struct sl811 *sl811) 1508 1508 { 1509 - struct proc_dir_entry *pde; 1510 - 1511 - pde = create_proc_entry(proc_filename, 0, NULL); 1512 - if (pde == NULL) 1513 - return; 1514 - 1515 - pde->proc_fops = &proc_ops; 1516 - pde->data = sl811; 1517 - sl811->pde = pde; 1509 + sl811->pde = proc_create_data(proc_filename, 0, NULL, &proc_ops, sl811); 1518 1510 } 1519 1511 1520 1512 static void remove_debug_file(struct sl811 *sl811)