提交 ef1f7a7e 编写于 作者: B Bernd Schmidt 提交者: Linus Torvalds

ROMFS: fix length used with romfs_dev_strnlen() function

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: NBernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: NMike Frysinger <vapier@gentoo.org>
Signed-off-by: NDavid Howells <dhowells@redhat.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 c6c59927
...@@ -253,11 +253,11 @@ ssize_t romfs_dev_strnlen(struct super_block *sb, ...@@ -253,11 +253,11 @@ ssize_t romfs_dev_strnlen(struct super_block *sb,
#ifdef CONFIG_ROMFS_ON_MTD #ifdef CONFIG_ROMFS_ON_MTD
if (sb->s_mtd) if (sb->s_mtd)
return romfs_mtd_strnlen(sb, pos, limit); return romfs_mtd_strnlen(sb, pos, maxlen);
#endif #endif
#ifdef CONFIG_ROMFS_ON_BLOCK #ifdef CONFIG_ROMFS_ON_BLOCK
if (sb->s_bdev) if (sb->s_bdev)
return romfs_blk_strnlen(sb, pos, limit); return romfs_blk_strnlen(sb, pos, maxlen);
#endif #endif
return -EIO; return -EIO;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册