Skip to contentSkip to conversation

Avoid oops in proc_delete_inode

PATCH In review Keith Owens 4 participants 4 messages Nov 4, 2004 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid oops in proc_delete_inode

Under heavy load, vmstat, top and other programs that access /proc can oops. PROC_INODE_PROPER(inode) is sometimes false for pid entries (usually zombies), but inode->u.generic_ip is not NULL.

Backport a fix by AL Viro from 2.5.7-pre2 to 2.4.28-rc1.

fs/proc/base.c +1 -0
Index: 2.4.28-rc1/fs/proc/base.c
===================================================================
@@ -780,6 +780,7 @@ out:
 	return inode;
 
 out_unlock:
+	node->u.generic_ip = NULL;
 	iput(inode);
 	return NULL;
 }
#1 lore raw

On Thursday 04 November 2004 03:35, Keith Owens wrote:

Marcelo,

I just saw you applied this to bk. Cool, but please apply a right version ;)

Quoted 13 lines

Under heavy load, vmstat, top and other programs that access /proc can oops. PROC_INODE_PROPER(inode) is sometimes false for pid entries (usually zombies), but inode->u.generic_ip is not NULL.

Backport a fix by AL Viro from 2.5.7-pre2 to 2.4.28-rc1.

Index: 2.4.28-rc1/fs/proc/base.c
===================================================================

fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 out: · line 783

Quoted 4 lines
fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 renamed from fs/proc/base.c 2004-08-08 10:10:49.000000000 +1000 +1 -0
@@ -780,6 +780,7 @@ out:
  return inode;
 
 out_unlock:
+ node->u.generic_ip = NULL;

has to be:

+ inode->u.generic_ip = NULL;

fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 out: · line 786

Quoted 3 lines
fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 renamed from fs/proc/base.c 2004-08-08 10:10:49.000000000 +1000 +0 -0
  iput(inode);
  return NULL;
 }

ciao, Marc

#2 lore raw
Quoted 21 lines · Marc-Christian Petersen

On Thursday 04 November 2004 03:35, Keith Owens wrote:

Marcelo,

I just saw you applied this to bk. Cool, but please apply a right version ;)

Quoted 15 lines

Under heavy load, vmstat, top and other programs that access /proc can oops. PROC_INODE_PROPER(inode) is sometimes false for pid entries (usually zombies), but inode->u.generic_ip is not NULL.

Backport a fix by AL Viro from 2.5.7-pre2 to 2.4.28-rc1.

Index: 2.4.28-rc1/fs/proc/base.c
===================================================================

fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 renamed from fs/proc/base.c 2004-08-08 10:10:49.000000000 +1000 +0 -0
@@ -780,6 +780,7 @@ out:
  return inode;
 
Quoted 10 lines

fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 out: · line 783

Quoted 2 lines
fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 renamed from fs/proc/base.c 2004-08-08 10:10:49.000000000 +1000 +1 -0
 out_unlock:
+ node->u.generic_ip = NULL;

has to be:

+ inode->u.generic_ip = NULL;

Quoted 3 lines
fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 renamed from fs/proc/base.c 2004-08-08 10:10:49.000000000 +1000 +0 -0
  iput(inode);
  return NULL;
 }

Oops, copied the old patch into the mail. Where did I put that brown paper bag?

#3 lore raw
In reply to Marc-Christian Petersen
Quoted 21 lines · Marc-Christian Petersen

On Thursday 04 November 2004 03:35, Keith Owens wrote:

Marcelo,

I just saw you applied this to bk. Cool, but please apply a right version ;)

Quoted 15 lines

Under heavy load, vmstat, top and other programs that access /proc can oops. PROC_INODE_PROPER(inode) is sometimes false for pid entries (usually zombies), but inode->u.generic_ip is not NULL.

Backport a fix by AL Viro from 2.5.7-pre2 to 2.4.28-rc1.

Index: 2.4.28-rc1/fs/proc/base.c
===================================================================

fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 renamed from fs/proc/base.c 2004-08-08 10:10:49.000000000 +1000 +0 -0
@@ -780,6 +780,7 @@ out:
  return inode;
 
Quoted 6 lines

fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 out: · line 783

Quoted 2 lines
fs/proc/base.c 2004-11-04 13:25:16.402602459 +1100 renamed from fs/proc/base.c 2004-08-08 10:10:49.000000000 +1000 +1 -0
 out_unlock:
+ node->u.generic_ip = NULL;

has to be:

+ inode->u.generic_ip = NULL;

Done, thanks.