Skip to content

Commit ef1f7a7

Browse files
berndstorvalds
authored andcommitted
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: 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>
1 parent c6c5992 commit ef1f7a7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎fs/romfs/storage.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ ssize_t romfs_dev_strnlen(struct super_block *sb,
253253

254254
#ifdef CONFIG_ROMFS_ON_MTD
255255
if (sb->s_mtd)
256-
return romfs_mtd_strnlen(sb, pos, limit);
256+
return romfs_mtd_strnlen(sb, pos, maxlen);
257257
#endif
258258
#ifdef CONFIG_ROMFS_ON_BLOCK
259259
if (sb->s_bdev)
260-
return romfs_blk_strnlen(sb, pos, limit);
260+
return romfs_blk_strnlen(sb, pos, maxlen);
261261
#endif
262262
return -EIO;
263263
}

0 commit comments

Comments
 (0)