OSDN Git Service

libext2fs: only link an inode into a directory once
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 1 Oct 2013 01:26:55 +0000 (18:26 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 7 Oct 2013 13:13:59 +0000 (09:13 -0400)
commit7320cb7106e5f5a552d07432e9322e1059c02bf3
tree46635f87ac2d15b2b4773546d60f141842a0a0de
parent7447da02f05699894c6f277f2518bd00ffc33906
libext2fs: only link an inode into a directory once

The ext2fs_link helper function link_proc does not check the value of
ls->done, which means that if the function finds multiple empty spaces
that will fit the new directory entry, it will create a directory
entry in each of the spaces.  Instead of doing that, check the done
value and don't do anything more if we've already added the directory
entry.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/link.c