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

[PATCH] ncpfs: Use struct pid to track the userspace watchdog process

This patch converts the tracking of the user space watchdog process from using
a pid_t to use struct pid. This makes us safe from pid wrap around issues and
prepares the way for the pid namespace.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Petr Vandrovec <VANDROVE@vc.cvut.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Eric W. Biederman and committed by
Linus Torvalds
2154227a a71113da

+7 -6
+6 -5
fs/ncpfs/inode.c
··· 331 331 data->flags = 0; 332 332 data->int_flags = 0; 333 333 data->mounted_uid = 0; 334 - data->wdog_pid = -1; 334 + data->wdog_pid = NULL; 335 335 data->ncp_fd = ~0; 336 336 data->time_out = 10; 337 337 data->retry_count = 20; ··· 371 371 data->flags = optint; 372 372 break; 373 373 case 'w': 374 - data->wdog_pid = optint; 374 + data->wdog_pid = find_get_pid(optint); 375 375 break; 376 376 case 'n': 377 377 data->ncp_fd = optint; ··· 425 425 data.flags = md->flags; 426 426 data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE; 427 427 data.mounted_uid = md->mounted_uid; 428 - data.wdog_pid = md->wdog_pid; 428 + data.wdog_pid = find_get_pid(md->wdog_pid); 429 429 data.ncp_fd = md->ncp_fd; 430 430 data.time_out = md->time_out; 431 431 data.retry_count = md->retry_count; ··· 445 445 data.flags = md->flags; 446 446 data.int_flags = 0; 447 447 data.mounted_uid = md->mounted_uid; 448 - data.wdog_pid = md->wdog_pid; 448 + data.wdog_pid = find_get_pid(md->wdog_pid); 449 449 data.ncp_fd = md->ncp_fd; 450 450 data.time_out = md->time_out; 451 451 data.retry_count = md->retry_count; ··· 711 711 if (server->info_filp) 712 712 fput(server->info_filp); 713 713 fput(server->ncp_filp); 714 - kill_proc(server->m.wdog_pid, SIGTERM, 1); 714 + kill_pid(server->m.wdog_pid, SIGTERM, 1); 715 + put_pid(server->m.wdog_pid); 715 716 716 717 kfree(server->priv.data); 717 718 kfree(server->auth.object_name);
+1 -1
include/linux/ncp_mount.h
··· 75 75 unsigned int int_flags; /* internal flags */ 76 76 #define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001 77 77 __kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */ 78 - __kernel_pid_t wdog_pid; /* Who cares for our watchdog packets? */ 78 + struct pid *wdog_pid; /* Who cares for our watchdog packets? */ 79 79 unsigned int ncp_fd; /* The socket to the ncp port */ 80 80 unsigned int time_out; /* How long should I wait after 81 81 sending a NCP request? */