Commit 2154227a authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Linus Torvalds

[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: default avatarEric W. Biederman <ebiederm@xmission.com>
Cc: Petr Vandrovec <VANDROVE@vc.cvut.cz>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a71113da
...@@ -331,7 +331,7 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options) ...@@ -331,7 +331,7 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
data->flags = 0; data->flags = 0;
data->int_flags = 0; data->int_flags = 0;
data->mounted_uid = 0; data->mounted_uid = 0;
data->wdog_pid = -1; data->wdog_pid = NULL;
data->ncp_fd = ~0; data->ncp_fd = ~0;
data->time_out = 10; data->time_out = 10;
data->retry_count = 20; data->retry_count = 20;
...@@ -371,7 +371,7 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options) ...@@ -371,7 +371,7 @@ static int ncp_parse_options(struct ncp_mount_data_kernel *data, char *options)
data->flags = optint; data->flags = optint;
break; break;
case 'w': case 'w':
data->wdog_pid = optint; data->wdog_pid = find_get_pid(optint);
break; break;
case 'n': case 'n':
data->ncp_fd = optint; data->ncp_fd = optint;
...@@ -425,7 +425,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent) ...@@ -425,7 +425,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
data.flags = md->flags; data.flags = md->flags;
data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE; data.int_flags = NCP_IMOUNT_LOGGEDIN_POSSIBLE;
data.mounted_uid = md->mounted_uid; data.mounted_uid = md->mounted_uid;
data.wdog_pid = md->wdog_pid; data.wdog_pid = find_get_pid(md->wdog_pid);
data.ncp_fd = md->ncp_fd; data.ncp_fd = md->ncp_fd;
data.time_out = md->time_out; data.time_out = md->time_out;
data.retry_count = md->retry_count; 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,7 +445,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
data.flags = md->flags; data.flags = md->flags;
data.int_flags = 0; data.int_flags = 0;
data.mounted_uid = md->mounted_uid; data.mounted_uid = md->mounted_uid;
data.wdog_pid = md->wdog_pid; data.wdog_pid = find_get_pid(md->wdog_pid);
data.ncp_fd = md->ncp_fd; data.ncp_fd = md->ncp_fd;
data.time_out = md->time_out; data.time_out = md->time_out;
data.retry_count = md->retry_count; data.retry_count = md->retry_count;
...@@ -711,7 +711,8 @@ static void ncp_put_super(struct super_block *sb) ...@@ -711,7 +711,8 @@ static void ncp_put_super(struct super_block *sb)
if (server->info_filp) if (server->info_filp)
fput(server->info_filp); fput(server->info_filp);
fput(server->ncp_filp); fput(server->ncp_filp);
kill_proc(server->m.wdog_pid, SIGTERM, 1); kill_pid(server->m.wdog_pid, SIGTERM, 1);
put_pid(server->m.wdog_pid);
kfree(server->priv.data); kfree(server->priv.data);
kfree(server->auth.object_name); kfree(server->auth.object_name);
......
...@@ -75,7 +75,7 @@ struct ncp_mount_data_kernel { ...@@ -75,7 +75,7 @@ struct ncp_mount_data_kernel {
unsigned int int_flags; /* internal flags */ unsigned int int_flags; /* internal flags */
#define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001 #define NCP_IMOUNT_LOGGEDIN_POSSIBLE 0x0001
__kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */ __kernel_uid32_t mounted_uid; /* Who may umount() this filesystem? */
__kernel_pid_t wdog_pid; /* Who cares for our watchdog packets? */ struct pid *wdog_pid; /* Who cares for our watchdog packets? */
unsigned int ncp_fd; /* The socket to the ncp port */ unsigned int ncp_fd; /* The socket to the ncp port */
unsigned int time_out; /* How long should I wait after unsigned int time_out; /* How long should I wait after
sending a NCP request? */ sending a NCP request? */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment