[Containers] [PATCH 6/7] vt: Update spawnpid to be a struct pid_t

Ray Lehtiniemi rayl at mail.com
Tue Aug 15 12:38:45 PDT 2006


On Tuesday 15 August 2006 12:23, Eric W. Biederman wrote:
> This keeps the wrong process from being notified if the
> daemon to spawn a new console dies.
>
> Signed-off-by: Eric W. Biederman <ebiederm at xmission.com>
> ---
>  drivers/char/keyboard.c |    9 ++++++---
>  drivers/char/vt_ioctl.c |    5 +++--
>  2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
> index 3e90aac..9acd142 100644
> --- a/drivers/char/keyboard.c
> +++ b/drivers/char/keyboard.c
> @@ -108,7 +108,8 @@ const int NR_TYPES = ARRAY_SIZE(max_vals
>  struct kbd_struct kbd_table[MAX_NR_CONSOLES];
>  static struct kbd_struct *kbd = kbd_table;
>
> -int spawnpid, spawnsig;
> +struct pid *spawnpid;
> +int spawnsig;
>
>  /*
>   * Variables exported for vt.c
> @@ -579,8 +580,10 @@ static void fn_compose(struct vc_data *v
>  static void fn_spawn_con(struct vc_data *vc, struct pt_regs *regs)
>  {
>  	if (spawnpid)
> -		if (kill_proc(spawnpid, spawnsig, 1))
> -			spawnpid = 0;
> +		if (kill_pid(spawnpid, spawnsig, 1)) {
> +			put_pid(spawnpid);
> +			spawnpid = NULL;
> +		}
>  }
>
>  static void fn_SAK(struct vc_data *vc, struct pt_regs *regs)
> diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
> index 28eff1a..d7e0187 100644
> --- a/drivers/char/vt_ioctl.c
> +++ b/drivers/char/vt_ioctl.c
> @@ -645,12 +645,13 @@ #endif
>  	 */
>  	case KDSIGACCEPT:
>  	{
> -		extern int spawnpid, spawnsig;
> +		struct pid *spawnpid;
> +		extern int spawnsig;


shouldn't spawnpid also be declared 'extern' here?






>  		if (!perm || !capable(CAP_KILL))
>  		  return -EPERM;
>  		if (!valid_signal(arg) || arg < 1 || arg == SIGKILL)
>  		  return -EINVAL;
> -		spawnpid = current->pid;
> +		spawnpid = get_pid(task_pid(current));
>  		spawnsig = arg;
>  		return 0;
>  	}



More information about the Containers mailing list