aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-12-13 03:35:11 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:05:53 -0500
commit2154227a2c6cf04e28576b59c684123eb0e81958 (patch)
treea568074140eb7b63886a468315cb25224901a7bc
parenta71113da44063b587b5a4c2fc94c948a14f2bb43 (diff)
[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>
-rw-r--r--fs/ncpfs/inode.c11
-rw-r--r--include/linux/ncp_mount.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 47462ac94474..861d950ac99a 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -331,7 +331,7 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
331 data->flags = 0; 331 data->flags = 0;
332 data->int_flags = 0; 332 data->int_flags = 0;
333 data->mounted_uid = 0; 333 data->mounted_uid = 0;
334 data->wdog_pid = -1; 334 data->wdog_pid = NULL;
335 data->ncp_fd = ~0; 335 data->ncp_fd = ~0;
336 data->time_out = 10; 336 data->time_out = 10;
337 data->retry_count = 20; 337 data->retry_count = 20;
@@ -371,7 +371,7 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
371 data->flags = optint; 371 data->flags = optint;
372 break; 372 break;
373 case 'w': 373 case 'w':
374 data->wdog_pid = optint; 374 data->wdog_pid = find_get_pid(optint);
375 break; 375 break;
376 case 'n': 376 case 'n':
377 data->ncp_fd = optint; 377 data->ncp_fd = optint;
@@ -425,7 +425,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
425 data.flags = md->flags; 425 data.flags = md->flags;
426 data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE; 426 data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE;
427 data.mounted_uid = md->mounted_uid; 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 data.ncp_fd = md->ncp_fd; 429 data.ncp_fd = md->ncp_fd;
430 data.time_out = md->time_out; 430 data.time_out = md->time_out;
431 data.retry_count = md->retry_count; 431 data.retry_count = md->retry_count;
@@ -445,7 +445,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
445 data.flags = md->flags; 445 data.flags = md->flags;
446 data.int_flags = 0; 446 data.int_flags = 0;
447 data.mounted_uid = md->mounted_uid; 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 data.ncp_fd = md->ncp_fd; 449 data.ncp_fd = md->ncp_fd;
450 data.time_out = md->time_out; 450 data.time_out = md->time_out;
451 data.retry_count = md->retry_count; 451 data.retry_count = md->retry_count;
@@ -711,7 +711,8 @@ static void ncp_put_super(struct super_block *sb)
711 if (server->info_filp) 711 if (server->info_filp)
712 fput(server->info_filp); 712 fput(server->info_filp);
713 fput(server->ncp_filp); 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 kfree(server->priv.data); 717 kfree(server->priv.data);
717 kfree(server->auth.object_name); 718 kfree(server->auth.object_name);
diff --git a/include/linux/ncp_mount.h b/include/linux/ncp_mount.h
index f46bddcdbd3b..a2b549eb1eca 100644
--- a/include/linux/ncp_mount.h
+++ b/include/linux/ncp_mount.h
@@ -75,7 +75,7 @@ struct ncp_mount_data_kernel {
75 unsigned int int_flags; /* internal flags */ 75 unsigned int int_flags; /* internal flags */
76#define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001 76#define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001
77 __kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */ 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 unsigned int ncp_fd; /* The socket to the ncp port */ 79 unsigned int ncp_fd; /* The socket to the ncp port */
80 unsigned int time_out; /* How long should I wait after 80 unsigned int time_out; /* How long should I wait after
81 sending a NCP request? */ 81 sending a NCP request? */