All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org, hch@lst.de, liushixin2@huawei.com,
	akpm@linux-foundation.org
Subject: + fs-sysv-check-sbi-s_firstdatazone-in-complete_read_super.patch added to -mm tree
Date: Mon, 04 Apr 2022 12:06:08 -0700	[thread overview]
Message-ID: <20220404190609.969FDC340F3@smtp.kernel.org> (raw)


The patch titled
     Subject: fs: sysv: check sbi->s_firstdatazone in complete_read_super
has been added to the -mm tree.  Its filename is
     fs-sysv-check-sbi-s_firstdatazone-in-complete_read_super.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/fs-sysv-check-sbi-s_firstdatazone-in-complete_read_super.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/fs-sysv-check-sbi-s_firstdatazone-in-complete_read_super.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Liu Shixin <liushixin2@huawei.com>
Subject: fs: sysv: check sbi->s_firstdatazone in complete_read_super

sbi->s_firstinodezone is initialized to 2 and sbi->s_firstdatazone is read
from sbd.  There's no guarantee that sbi->s_firstdatazone must bigger than
sbi->s_firstinodezone.  If sbi->s_firstdatazone less than 2, the
filesystem can still be mounted unexpetly.  At this point, sbi->s_ninodes
flip to very large value and this filesystem is broken.  We can observe
this by executing 'df' command.  When we execute, we will get an error
message:

	"sysv_count_free_inodes: unable to read inode table"

Link: https://lkml.kernel.org/r/20220330104215.530223-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/sysv/super.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/fs/sysv/super.c~fs-sysv-check-sbi-s_firstdatazone-in-complete_read_super
+++ a/fs/sysv/super.c
@@ -312,7 +312,9 @@ static int complete_read_super(struct su
 	sbi->s_firstinodezone = 2;
 
 	flavour_setup[sbi->s_type](sbi, &sb->s_max_links);
-	
+	if (sbi->s_firstdatazone < sbi->s_firstinodezone)
+		return 0;
+
 	sbi->s_ndatazones = sbi->s_nzones - sbi->s_firstdatazone;
 	sbi->s_inodes_per_block = bsize >> 6;
 	sbi->s_inodes_per_block_1 = (bsize >> 6)-1;
_

Patches currently in -mm which might be from liushixin2@huawei.com are

fs-sysv-check-sbi-s_firstdatazone-in-complete_read_super.patch


                 reply	other threads:[~2022-04-04 21:41 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=20220404190609.969FDC340F3@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liushixin2@huawei.com \
    --cc=mm-commits@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.