verifying a task_struct

tyson@rwii.com
Thu, 11 Dec 1997 15:38:55 -0500 (EST)


How can I verify that a struct task_stuct pointer is still valid before
using it? The pointer is copied from current as part of an ioctl() but
I have found that if the process forks after the ioctl, the parent
exits and then the child continues to use the open file descriptor that
problems can result. Specifically, the driver ends up sending a signal
to a process that no longer exists and the system becomes unstable.

Who's job is it to verify a task_struct pointer before using it, the
driver or send_sig()?

/*
* If the user requested to be notified via signal,
* let them know the frame is complete.
*/
if(mtr->proc && mtr->signal)
send_sig(mtr->signal, mtr->proc, 1);

} else {
/* not complete frame yet, but check if user wants a signal each field a
nyway */
if (mtr->sigmode==METEOR_SIG_FIELD && mtr->proc && mtr->signal)
send_sig(mtr->signal, mtr->proc, 1);
}

Thanks!
Ty

-- 
Tyson D Sawyer                     Real World Interface, Inc.
Senior Systems Engineer            Robots for the Real World
tsawyer@rwii.com                   http://www.rwii.com/