lkml.org 
[lkml]   [1996]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectBug fix for sys_truncate
Date
There are two bugs in sys_truncate() in recent Linux versions of fs/open.c.
(1) There is an iput() missing if locks_verify_area() fails.
(2) Quotas are not reduced since the inode dquot fields aren't initialised.

Here is the fix as a unidiff patch against pre2.0.3 or later (I've checked
up to pre2.0.7 and none of those touches open.c).

--Malcolm

--
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Unix Systems Programmer
Oxford University Computing Services

------------------------------ cut here ------------------------------
--- open.c.ORI Thu May 23 15:08:08 1996
+++ open.c Thu May 23 15:13:03 1996
@@ -110,8 +110,13 @@
error = locks_verify_area(FLOCK_VERIFY_WRITE, inode, NULL,
length < inode->i_size ? length : inode->i_size,
abs(inode->i_size - length));
- if (error)
+ if (error) {
+ iput(inode);
return error;
+ }
+ if (inode->i_sb && inode->i_sb->dq_op)
+ inode->i_sb->dq_op->initialize(inode, -1);
+
error = do_truncate(inode, length);
put_write_access(inode);
iput(inode);
------------------------------ cut here ------------------------------


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