From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Patrick Donnelly <batrick@batbytes.com>
Cc: Jiri Slaby <jslaby@suse.cz>, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] Check tcsetpgrp p is a process group.
Date: Sat, 27 Jun 2015 16:27:05 -0700 [thread overview]
Message-ID: <20150627232705.GC6433@kroah.com> (raw)
In-Reply-To: <1435439824-3975-2-git-send-email-batrick@batbytes.com>
On Sat, Jun 27, 2015 at 05:17:03PM -0400, Patrick Donnelly wrote:
> 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 | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> index 401d05e..c20a2fb 100644
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -2560,9 +2560,11 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
> {
> struct pid *pgrp;
> pid_t pgrp_nr;
> - int retval = tty_check_change(real_tty);
> + int retval;
> unsigned long flags;
>
> + retval = tty_check_change(real_tty);
> +
> if (retval == -EIO)
> return -ENOTTY;
> if (retval)
> @@ -2580,6 +2582,10 @@ 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;
Always run your patches though checkpatch.pl so you don't get emails
telling you to fix the things that checkpatch.pl tells you to...
next prev parent reply other threads:[~2015-06-27 23:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-27 21:17 [PATCH 1/2] Add missing rcu_read_lock for task_pgrp Patrick Donnelly
2015-06-27 21:17 ` [PATCH 2/2] Check tcsetpgrp p is a process group Patrick Donnelly
2015-06-27 23:26 ` Greg Kroah-Hartman
2015-06-28 0:53 ` Patrick Donnelly
2015-06-27 23:27 ` Greg Kroah-Hartman [this message]
2015-06-27 23:25 ` [PATCH 1/2] Add missing rcu_read_lock for task_pgrp Greg Kroah-Hartman
2015-06-28 0:51 ` [PATCH v2 1/2] tty: add " Patrick Donnelly
2015-06-28 0:51 ` [PATCH v2 2/2] tty: check tcsetpgrp p is a process group Patrick Donnelly
2015-06-28 16:07 ` Peter Hurley
2015-06-29 1:27 ` Patrick Donnelly
2015-06-28 15:23 ` [PATCH v2 1/2] tty: add missing rcu_read_lock for task_pgrp Peter Hurley
2015-06-28 17:20 ` Patrick Donnelly
2015-06-28 19:21 ` Peter Hurley
2015-06-28 19:27 ` Peter Hurley
2015-06-29 23:38 ` Patrick Donnelly
2015-06-29 23:59 ` [PATCH v3] " Patrick Donnelly
2015-07-09 2:07 ` Peter Hurley
2015-07-12 2:05 ` Peter Hurley
2015-07-12 22:42 ` Patrick Donnelly
2015-07-12 22:51 ` [PATCH v4] " Patrick Donnelly
2015-07-13 0:35 ` Peter Hurley
2015-07-20 9:26 ` Jiri Slaby
2015-07-20 19:40 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150627232705.GC6433@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=batrick@batbytes.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.