提交 782237a2 编写于 作者: C Cedric Le Goater 提交者: Linus Torvalds

[PATCH] s390: update fs3270 to use a struct pid

Replaces the pid_t value with a struct pid to avoid pid wrap around
problems.
Signed-off-by: NCedric Le Goater <clg@fr.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Acked-by: NEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 2425c08b
...@@ -27,7 +27,7 @@ struct raw3270_fn fs3270_fn; ...@@ -27,7 +27,7 @@ struct raw3270_fn fs3270_fn;
struct fs3270 { struct fs3270 {
struct raw3270_view view; struct raw3270_view view;
pid_t fs_pid; /* Pid of controlling program. */ struct pid *fs_pid; /* Pid of controlling program. */
int read_command; /* ccw command to use for reads. */ int read_command; /* ccw command to use for reads. */
int write_command; /* ccw command to use for writes. */ int write_command; /* ccw command to use for writes. */
int attention; /* Got attention. */ int attention; /* Got attention. */
...@@ -102,7 +102,7 @@ fs3270_restore_callback(struct raw3270_request *rq, void *data) ...@@ -102,7 +102,7 @@ fs3270_restore_callback(struct raw3270_request *rq, void *data)
fp = (struct fs3270 *) rq->view; fp = (struct fs3270 *) rq->view;
if (rq->rc != 0 || rq->rescnt != 0) { if (rq->rc != 0 || rq->rescnt != 0) {
if (fp->fs_pid) if (fp->fs_pid)
kill_proc(fp->fs_pid, SIGHUP, 1); kill_pid(fp->fs_pid, SIGHUP, 1);
} }
fp->rdbuf_size = 0; fp->rdbuf_size = 0;
raw3270_request_reset(rq); raw3270_request_reset(rq);
...@@ -173,7 +173,7 @@ fs3270_save_callback(struct raw3270_request *rq, void *data) ...@@ -173,7 +173,7 @@ fs3270_save_callback(struct raw3270_request *rq, void *data)
*/ */
if (rq->rc != 0 || rq->rescnt == 0) { if (rq->rc != 0 || rq->rescnt == 0) {
if (fp->fs_pid) if (fp->fs_pid)
kill_proc(fp->fs_pid, SIGHUP, 1); kill_pid(fp->fs_pid, SIGHUP, 1);
fp->rdbuf_size = 0; fp->rdbuf_size = 0;
} else } else
fp->rdbuf_size = fp->rdbuf->size - rq->rescnt; fp->rdbuf_size = fp->rdbuf->size - rq->rescnt;
...@@ -442,7 +442,7 @@ fs3270_open(struct inode *inode, struct file *filp) ...@@ -442,7 +442,7 @@ fs3270_open(struct inode *inode, struct file *filp)
return PTR_ERR(fp); return PTR_ERR(fp);
init_waitqueue_head(&fp->wait); init_waitqueue_head(&fp->wait);
fp->fs_pid = current->pid; fp->fs_pid = get_pid(task_pid(current));
rc = raw3270_add_view(&fp->view, &fs3270_fn, minor); rc = raw3270_add_view(&fp->view, &fs3270_fn, minor);
if (rc) { if (rc) {
fs3270_free_view(&fp->view); fs3270_free_view(&fp->view);
...@@ -480,7 +480,8 @@ fs3270_close(struct inode *inode, struct file *filp) ...@@ -480,7 +480,8 @@ fs3270_close(struct inode *inode, struct file *filp)
fp = filp->private_data; fp = filp->private_data;
filp->private_data = NULL; filp->private_data = NULL;
if (fp) { if (fp) {
fp->fs_pid = 0; put_pid(fp->fs_pid);
fp->fs_pid = NULL;
raw3270_reset(&fp->view); raw3270_reset(&fp->view);
raw3270_put_view(&fp->view); raw3270_put_view(&fp->view);
raw3270_del_view(&fp->view); raw3270_del_view(&fp->view);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册