* [PATCH] libext2fs: only use override function when reading an 128 byte inode
@ 2013-04-22 3:56 Theodore Ts'o
2013-04-22 15:11 ` Carlos Maiolino
0 siblings, 1 reply; 2+ messages in thread
From: Theodore Ts'o @ 2013-04-22 3:56 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: Theodore Ts'o
The ext2fs_read_inode_full() function should not use fs->read_inode()
if the caller has requested more than the base 128 byte inode
structure and the inode size is greater than 128 bytes. Otherwise the
caller won't get all of the bytes that they were asking for, since
there's no way for the fs->read_inode override function can know what
the size of the buffer passed to ext2fs_read_inode_full().
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
lib/ext2fs/inode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 77fc447..fd72d4c 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -533,7 +533,9 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
/* Check to see if user has an override function */
- if (fs->read_inode) {
+ if (fs->read_inode &&
+ ((bufsize == sizeof(struct ext2_inode)) ||
+ (EXT2_INODE_SIZE(fs->super) == sizeof(struct ext2_inode)))) {
retval = (fs->read_inode)(fs, ino, inode);
if (retval != EXT2_ET_CALLBACK_NOTHANDLED)
return retval;
--
1.7.12.rc0.22.gcdd159b
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libext2fs: only use override function when reading an 128 byte inode
2013-04-22 3:56 [PATCH] libext2fs: only use override function when reading an 128 byte inode Theodore Ts'o
@ 2013-04-22 15:11 ` Carlos Maiolino
0 siblings, 0 replies; 2+ messages in thread
From: Carlos Maiolino @ 2013-04-22 15:11 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Ext4 Developers List
Looks Good,
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
On Sun, Apr 21, 2013 at 11:56:09PM -0400, Theodore Ts'o wrote:
> The ext2fs_read_inode_full() function should not use fs->read_inode()
> if the caller has requested more than the base 128 byte inode
> structure and the inode size is greater than 128 bytes. Otherwise the
> caller won't get all of the bytes that they were asking for, since
> there's no way for the fs->read_inode override function can know what
> the size of the buffer passed to ext2fs_read_inode_full().
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
> lib/ext2fs/inode.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
> index 77fc447..fd72d4c 100644
> --- a/lib/ext2fs/inode.c
> +++ b/lib/ext2fs/inode.c
> @@ -533,7 +533,9 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
> EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
>
> /* Check to see if user has an override function */
> - if (fs->read_inode) {
> + if (fs->read_inode &&
> + ((bufsize == sizeof(struct ext2_inode)) ||
> + (EXT2_INODE_SIZE(fs->super) == sizeof(struct ext2_inode)))) {
> retval = (fs->read_inode)(fs, ino, inode);
> if (retval != EXT2_ET_CALLBACK_NOTHANDLED)
> return retval;
> --
> 1.7.12.rc0.22.gcdd159b
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Carlos
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-22 15:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-22 3:56 [PATCH] libext2fs: only use override function when reading an 128 byte inode Theodore Ts'o
2013-04-22 15:11 ` Carlos Maiolino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).