diff options
author | David Howells <dhowells@redhat.com> | 2009-04-23 11:41:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-24 16:28:31 -0400 |
commit | 84baf74bf23bbe9f3deafb5d2f27e2b5dc0bc052 (patch) | |
tree | 45af84d051ca760a9f9f24aa3775e5505ccd3627 /fs/romfs/super.c | |
parent | a5422a5111811401f7756345e4c237ff06cf6d1e (diff) |
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>
Diffstat (limited to 'fs/romfs/super.c')
-rw-r--r-- | fs/romfs/super.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/romfs/super.c b/fs/romfs/super.c index 10ca7d984a8..c53b5ef8a02 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c | |||
@@ -240,8 +240,8 @@ static struct dentry *romfs_lookup(struct inode *dir, struct dentry *dentry, | |||
240 | goto error; | 240 | goto error; |
241 | 241 | ||
242 | /* try to match the first 16 bytes of name */ | 242 | /* try to match the first 16 bytes of name */ |
243 | ret = romfs_dev_strncmp(dir->i_sb, offset + ROMFH_SIZE, name, | 243 | ret = romfs_dev_strcmp(dir->i_sb, offset + ROMFH_SIZE, name, |
244 | len); | 244 | len); |
245 | if (ret < 0) | 245 | if (ret < 0) |
246 | goto error; | 246 | goto error; |
247 | if (ret == 1) | 247 | if (ret == 1) |