lkml.org 
[lkml]   [2003]   [Oct]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 2.6.0-test9 and sleeping function called from invalid context
What about the attached patch?

The lifetime of dentries is quite long, thus I'd prefer if the race
between proc_pid_lookup and sys_exit is closed.

--
Manfred

--- 2.6/fs/proc/base.c 2003-10-09 21:23:15.000000000 +0200
+++ build-2.6/fs/proc/base.c 2003-10-26 16:25:24.000000000 +0100
@@ -1524,6 +1524,7 @@
struct inode *inode;
struct proc_inode *ei;
unsigned tgid;
+ int died;

if (dentry->d_name.len == 4 && !memcmp(dentry->d_name.name,"self",4)) {
inode = new_inode(dir->i_sb);
@@ -1567,12 +1568,21 @@

dentry->d_op = &pid_base_dentry_operations;

+ died = 0;
+ d_add(dentry, inode);
spin_lock(&task->proc_lock);
task->proc_dentry = dentry;
- d_add(dentry, inode);
+ if (!pid_alive(task)) {
+ dentry = proc_pid_unhash(task);
+ died = 1;
+ }
spin_unlock(&task->proc_lock);

put_task_struct(task);
+ if (died) {
+ proc_pid_flush(dentry);
+ goto out;
+ }
return NULL;
out:
return ERR_PTR(-ENOENT);
@@ -1612,10 +1622,7 @@

dentry->d_op = &pid_base_dentry_operations;

- spin_lock(&task->proc_lock);
- task->proc_dentry = dentry;
d_add(dentry, inode);
- spin_unlock(&task->proc_lock);

put_task_struct(task);
return NULL;
\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.056 / U:1.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site