linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Parisc List <linux-parisc@vger.kernel.org>
Subject: [PATCH palo] ext2: fix ext4 group cache
Date: Sun, 04 Aug 2019 08:26:20 -0700	[thread overview]
Message-ID: <1564932380.3401.1.camel@HansenPartnership.com> (raw)

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


                 reply	other threads:[~2019-08-04 15:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1564932380.3401.1.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).