Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a71113da authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Linus Torvalds
Browse files

[PATCH] smbfs: Make conn_pid a struct pid



smbfs keeps track of the user space server process in conn_pid.  This converts
that track to use a struct pid instead of pid_t.  This keeps 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>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3cec556a
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -482,12 +482,13 @@ smb_put_super(struct super_block *sb)
	smb_close_socket(server);
	smb_close_socket(server);


	if (server->conn_pid)
	if (server->conn_pid)
		kill_proc(server->conn_pid, SIGTERM, 1);
		kill_pid(server->conn_pid, SIGTERM, 1);


	kfree(server->ops);
	kfree(server->ops);
	smb_unload_nls(server);
	smb_unload_nls(server);
	sb->s_fs_info = NULL;
	sb->s_fs_info = NULL;
	smb_unlock_server(server);
	smb_unlock_server(server);
	put_pid(server->conn_pid);
	kfree(server);
	kfree(server);
}
}


@@ -530,7 +531,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent)
	INIT_LIST_HEAD(&server->xmitq);
	INIT_LIST_HEAD(&server->xmitq);
	INIT_LIST_HEAD(&server->recvq);
	INIT_LIST_HEAD(&server->recvq);
	server->conn_error = 0;
	server->conn_error = 0;
	server->conn_pid = 0;
	server->conn_pid = NULL;
	server->state = CONN_INVALID; /* no connection yet */
	server->state = CONN_INVALID; /* no connection yet */
	server->generation = 0;
	server->generation = 0;


+3 −3
Original line number Original line Diff line number Diff line
@@ -877,7 +877,7 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
		goto out_putf;
		goto out_putf;


	server->sock_file = filp;
	server->sock_file = filp;
	server->conn_pid = current->pid;
	server->conn_pid = get_pid(task_pid(current));
	server->opt = *opt;
	server->opt = *opt;
	server->generation += 1;
	server->generation += 1;
	server->state = CONN_VALID;
	server->state = CONN_VALID;
@@ -971,8 +971,8 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt)
	}
	}


	VERBOSE("protocol=%d, max_xmit=%d, pid=%d capabilities=0x%x\n",
	VERBOSE("protocol=%d, max_xmit=%d, pid=%d capabilities=0x%x\n",
		server->opt.protocol, server->opt.max_xmit, server->conn_pid,
		server->opt.protocol, server->opt.max_xmit,
		server->opt.capabilities);
		pid_nr(server->conn_pid), server->opt.capabilities);


	/* FIXME: this really should be done by smbmount. */
	/* FIXME: this really should be done by smbmount. */
	if (server->opt.max_xmit > SMB_MAX_PACKET_SIZE) {
	if (server->opt.max_xmit > SMB_MAX_PACKET_SIZE) {
+3 −2
Original line number Original line Diff line number Diff line
@@ -152,7 +152,7 @@ int smbiod_retry(struct smb_sb_info *server)
{
{
	struct list_head *head;
	struct list_head *head;
	struct smb_request *req;
	struct smb_request *req;
	pid_t pid = server->conn_pid;
	struct pid *pid = get_pid(server->conn_pid);
	int result = 0;
	int result = 0;


	VERBOSE("state: %d\n", server->state);
	VERBOSE("state: %d\n", server->state);
@@ -222,7 +222,7 @@ int smbiod_retry(struct smb_sb_info *server)
	/*
	/*
	 * Note: use the "priv" flag, as a user process may need to reconnect.
	 * Note: use the "priv" flag, as a user process may need to reconnect.
	 */
	 */
	result = kill_proc(pid, SIGUSR1, 1);
	result = kill_pid(pid, SIGUSR1, 1);
	if (result) {
	if (result) {
		/* FIXME: this is most likely fatal, umount? */
		/* FIXME: this is most likely fatal, umount? */
		printk(KERN_ERR "smb_retry: signal failed [%d]\n", result);
		printk(KERN_ERR "smb_retry: signal failed [%d]\n", result);
@@ -233,6 +233,7 @@ int smbiod_retry(struct smb_sb_info *server)
	/* FIXME: The retried requests should perhaps get a "time boost". */
	/* FIXME: The retried requests should perhaps get a "time boost". */


out:
out:
	put_pid(pid);
	return result;
	return result;
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -55,7 +55,7 @@ struct smb_sb_info {
	 * generation is incremented.
	 * generation is incremented.
	 */
	 */
	unsigned int generation;
	unsigned int generation;
	pid_t conn_pid;
	struct pid *conn_pid;
	struct smb_conn_opt opt;
	struct smb_conn_opt opt;
	wait_queue_head_t conn_wq;
	wait_queue_head_t conn_wq;
	int conn_complete;
	int conn_complete;