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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
> ---
>  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;
>  	}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux