lkml.org 
[lkml]   [1997]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectverifying a task_struct
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/


\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.044 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site