ROMFS: romfs_lookup() shouldn't be doing a partial name comparison

romfs_lookup() should be using a routine akin to strcmp() on the backing store,
rather than one akin to strncmp().  If it uses the latter, it's liable to match
/bin/shutdown when looking up /bin/sh.

Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
David Howells
2009-04-23 16:41:13 +01:00
committed by Linus Torvalds
parent a5422a5111
commit 84baf74bf2
3 changed files with 53 additions and 22 deletions

View File

@ -240,8 +240,8 @@ static struct dentry *romfs_lookup(struct inode *dir, struct dentry *dentry,
goto error;
/* try to match the first 16 bytes of name */
ret = romfs_dev_strncmp(dir->i_sb, offset + ROMFH_SIZE, name,
len);
ret = romfs_dev_strcmp(dir->i_sb, offset + ROMFH_SIZE, name,
len);
if (ret < 0)
goto error;
if (ret == 1)