Skip to contentSkip to conversation

zero out i_blocks in get_pipe_inode

PATCH In review Martin J. Bligh 3 participants 4 messages Nov 11, 2003 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zero out i_blocks in get_pipe_inode

Fished from the 2.4 SuSE tree, which I'm trawling through. This seems like a perfectly reasonable thing to do to me, there was some discussion earlier on IRC. Some extracts from the conversation were "returning random old data from the kernel is always a bug", "any userland code that trips on that one is broken", and "iirc it broke postfix". Nobody seemed to think it was actively evil, and it seems to fix a bug ;-)

fs/pipe.c +1 -0
diff -purN -X /home/mbligh/.diff.exclude virgin/fs/pipe.c pipe_init/fs/pipe.c
@@ -527,6 +527,7 @@ static struct inode * get_pipe_inode(voi
 	inode->i_gid = current->fsgid;
 	inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 	inode->i_blksize = PAGE_SIZE;
+	inode->i_blocks = 0;
 	return inode;
 
 fail_iput:
#1 lore raw
Quoted 2 lines · Martin J. Bligh

+ inode->i_blocks = 0;

alloc_inode() already did that.

#2 lore raw
Quoted 5 lines · On Tue, 11 Nov 2003 14:48:42 -0800 Andrew Morton <[email protected]> wrote:
Quoted 2 lines · Martin J. Bligh

+ inode->i_blocks = 0;

alloc_inode() already did that.

It didn't in 2.4 I think. But it may be worth auditing if all fields are covered.

-Andi

#3 lore raw
In reply to Andrew Morton
Quoted 3 lines
Quoted 1 line

+ inode->i_blocks = 0;

alloc_inode() already did that.

Sigh ... yes, you're right - sorry.

get_pipe_inode -> new_inode -> alloc_inode. definitely covered.

I shall crawl back under my regularly scheduled stone ;-)

M.