Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1173439
| From | Patrick Donnelly <batrick@batbytes.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/2] tty: check tcsetpgrp p is a process group |
| Date | 2015-06-28 03:00 +0200 |
| Message-ID | <pG96V-5r8-13@gated-at.bofh.it> (permalink) |
| References | <pG5G2-JJ-3@gated-at.bofh.it> <pG96V-5r8-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This fixes a bug where a process can set the foreground process group to its pid even if its pid is not a valid pgrp. Signed-off-by: Patrick Donnelly <batrick@batbytes.com> --- drivers/tty/tty_io.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index fbb55db..01b4769 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2579,6 +2579,9 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t retval = -ESRCH; if (!pgrp) goto out_unlock; + retval = -EINVAL; + if (!pid_task(pgrp, PIDTYPE_PGID)) + goto out_unlock; retval = -EPERM; if (session_of_pgrp(pgrp) != task_session(current)) goto out_unlock; -- Patrick Donnelly -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 1/2] tty: add missing rcu_read_lock for task_pgrp Patrick Donnelly <batrick@batbytes.com> - 2015-06-28 03:00 +0200
[PATCH v2 2/2] tty: check tcsetpgrp p is a process group Patrick Donnelly <batrick@batbytes.com> - 2015-06-28 03:00 +0200
Re: [PATCH v2 2/2] tty: check tcsetpgrp p is a process group Patrick Donnelly <batrick@batbytes.com> - 2015-06-29 03:30 +0200
Re: [PATCH v2 1/2] tty: add missing rcu_read_lock for task_pgrp Patrick Donnelly <batrick@batbytes.com> - 2015-06-30 01:40 +0200
csiph-web