linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH palo] ext2: fix ext4 group cache
@ 2019-08-04 15:26 James Bottomley
  0 siblings, 0 replies; only message in thread
From: James Bottomley @ 2019-08-04 15:26 UTC (permalink / raw)
  To: Parisc List

The ext4 group cache is truncated because the read that populates it
is assuming ext2 fixed group size and not using the ext4 variable
group size.  This only shows up with large inode numbers because the
read stops before their contents is read.  The upshot is when you try
to do ext2_iget() for an ext4 inode above a certain number it fails
because the group descriptor is random junk.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 ipl/ext2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipl/ext2.c b/ipl/ext2.c
index 96f6e4d..0729429 100644
--- a/ipl/ext2.c
+++ b/ipl/ext2.c
@@ -287,7 +287,7 @@ int ext2_mount(long cons_dev, long p_offset, long quiet)
 	if (Debug) printf("ext2 block size %d\n", ext2_blocksize);
 
 	/* read in the group descriptors (immediately follows superblock) */
-	cons_read(dev, gds, ngroups * sizeof(struct ext2_group_desc),
+	cons_read(dev, gds, ngroups * group_size,
 		  partition_offset +
                   ext2_blocksize * (EXT2_MIN_BLOCK_SIZE/ext2_blocksize + 1));
 	for (i = 0; i < ngroups; i++)
-- 
2.16.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-04 15:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-04 15:26 [PATCH palo] ext2: fix ext4 group cache James Bottomley

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).