Skip to content

Commit

Permalink
ROMFS: fix length used with romfs_dev_strnlen() function
Browse files Browse the repository at this point in the history
An interestingly corrupted romfs file system exposed a problem with the
romfs_dev_strnlen function: it's passing the wrong value to its helpers.
Rather than limit the string to the length passed in by the callers, it
uses the size of the device as the limit.

Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Bernd Schmidt authored and Linus Torvalds committed Oct 11, 2009
1 parent c6c5992 commit ef1f7a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/romfs/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ ssize_t romfs_dev_strnlen(struct super_block *sb,

#ifdef CONFIG_ROMFS_ON_MTD
if (sb->s_mtd)
return romfs_mtd_strnlen(sb, pos, limit);
return romfs_mtd_strnlen(sb, pos, maxlen);
#endif
#ifdef CONFIG_ROMFS_ON_BLOCK
if (sb->s_bdev)
return romfs_blk_strnlen(sb, pos, limit);
return romfs_blk_strnlen(sb, pos, maxlen);
#endif
return -EIO;
}
Expand Down

0 comments on commit ef1f7a7

Please sign in to comment.