lkml.org 
[lkml]   [1997]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] bugfixes for 2.1.47
Hello,

This are two small bugfixes for 2.1.47.

1. There is a memory leak in pipe.c.
2. double_down() in namei.c is fiddling with semaphore internals,
without fully knowing what it does. i_sem.waking is increased
afterwards and allows two processes two bypass the semaphore at the
same time.

Jochen

--- linux-2.1.47/fs/pipe.c Tue Jul 22 18:31:44 1997
+++ linux/fs/pipe.c Sat Jul 26 16:10:33 1997
@@ -483,6 +483,7 @@
close_f12_inode_i:
put_unused_fd(i);
close_f12_inode:
+ free_page((unsigned long) PIPE_BASE(*inode));
iput(inode);
close_f12:
put_filp(f2);
--- linux-2.1.47/fs/namei.c Fri Jul 25 18:41:00 1997
+++ linux/fs/namei.c Sun Jul 27 17:02:53 1997
@@ -1037,13 +1037,19 @@
down(s2);
} else if (s1 == s2) {
down(s1);
- atomic_dec(&s1->count);
} else {
down(s2);
down(s1);
}
}

+static inline void double_up(struct semaphore *s1, struct semaphore *s2)
+{
+ up(s1);
+ if (s1 != s2)
+ up(s2);
+}
+
static inline int is_reserved(struct dentry *dentry)
{
if (dentry->d_name.name[0] == '.') {
@@ -1126,8 +1132,7 @@
error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);

exit_lock:
- up(&new_dir->i_sem);
- up(&old_dir->i_sem);
+ double_up(&new_dir->i_sem, &old_dir->i_sem);
dput(new_dentry);
exit_old:
dput(old_dentry);
\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.019 / U:0.784 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site