Messages in this thread Patch in this message | | | Date | Mon, 28 Jul 97 13:56 MET DST | From | "Jochen Hoenicke" <> | 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);
| |