linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Richard Weinberger <richard.weinberger@gmail.com>
Cc: Naga Sureshkumar Relli <nagasure@xilinx.com>,
	Richard Weinberger <richard@nod.at>,
	siva durga paladugu <siva.durga.paladugu@xililnx.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Michal Simek <michals@xilinx.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	naga suresh kumar <nagasureshkumarrelli@gmail.com>,
	linux-mtd <linux-mtd@lists.infradead.org>
Subject: Re: ubifs mount failure
Date: Wed, 4 Dec 2019 08:17:46 +0100	[thread overview]
Message-ID: <20191204071746.kfdflui4ziladmjg@pengutronix.de> (raw)
In-Reply-To: <CAFLxGvywFxSrDLLGnLDW6+rMLVUA9Yoi=3sn7wdxqWMydy-w0g@mail.gmail.com>

On Tue, Dec 03, 2019 at 08:08:48PM +0100, Richard Weinberger wrote:
> On Tue, Dec 3, 2019 at 11:46 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
> >
> > On Tue, Dec 03, 2019 at 04:06:12PM +0530, naga suresh kumar wrote:
> > > Hi Richard,
> > >
> > > On Tue, Dec 3, 2019 at 2:40 PM Richard Weinberger <richard@nod.at> wrote:
> > > >
> > > > ----- Ursprüngliche Mail -----
> > > > > Von: "Naga Sureshkumar Relli" <nagasure@xilinx.com>
> > > > > https://elixir.bootlin.com/linux/v5.4/source/fs/ubifs/sb.c#L164
> > > > > we are trying to allocate 4325376 (~4MB)
> > > >
> > > > 4MiB? Is ->min_io_size that large?
> > > if you see https://elixir.bootlin.com/linux/latest/source/fs/ubifs/sb.c#L164
> > > The size is actually ALIGN(tmp, c->min_io_size).
> > > Here tmp is of 4325376 Bytes and min_io_size is 16384 Bytes
> >
> > 'tmp' contains bogus values. Try this:
> >
> > ----------------------------8<--------------------------------
> >
> > From 34f687fce189085f55706b4cddcb288a08f4ee06 Mon Sep 17 00:00:00 2001
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> > Date: Tue, 3 Dec 2019 11:41:20 +0100
> > Subject: [PATCH] ubifs: Fix wrong memory allocation
> >
> > In create_default_filesystem() when we allocate the idx node we must use
> > the idx_node_size we calculated just one line before, not tmp, which
> > contains completely other data.
> >
> > Fixes: c4de6d7e4319 ("ubifs: Refactor create_default_filesystem()")
> > Reported-by: Naga Sureshkumar Relli <nagasure@xilinx.com>
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> >  fs/ubifs/sb.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
> > index a551eb3e9b89..6681c18e52b8 100644
> > --- a/fs/ubifs/sb.c
> > +++ b/fs/ubifs/sb.c
> > @@ -161,7 +161,7 @@ static int create_default_filesystem(struct ubifs_info *c)
> >         sup = kzalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_KERNEL);
> >         mst = kzalloc(c->mst_node_alsz, GFP_KERNEL);
> >         idx_node_size = ubifs_idx_node_sz(c, 1);
> > -       idx = kzalloc(ALIGN(tmp, c->min_io_size), GFP_KERNEL);
> > +       idx = kzalloc(ALIGN(idx_node_size, c->min_io_size), GFP_KERNEL);
> >         ino = kzalloc(ALIGN(UBIFS_INO_NODE_SZ, c->min_io_size), GFP_KERNEL);
> >         cs = kzalloc(ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size), GFP_KERNEL);
> 
> Oh, looks good! Thanks for fixing, Sascha!

Will you apply this one? Otherwise I resend with the proper tags added.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2019-12-04  7:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <MN2PR02MB5727000CBE70BAF31F60FEE4AF420@MN2PR02MB5727.namprd02.prod.outlook.com>
2019-12-03  8:41 ` ubifs mount failure Sascha Hauer
2019-12-03  9:00   ` Naga Sureshkumar Relli
2019-12-03  9:10     ` Richard Weinberger
2019-12-03 10:36       ` naga suresh kumar
2019-12-03 10:45         ` Sascha Hauer
2019-12-03 10:53           ` naga suresh kumar
2019-12-04 10:08             ` Sascha Hauer
2019-12-03 19:08           ` Richard Weinberger
2019-12-04  7:17             ` Sascha Hauer [this message]
2019-12-04  9:05               ` Richard Weinberger

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=20191204071746.kfdflui4ziladmjg@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michals@xilinx.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=nagasure@xilinx.com \
    --cc=nagasureshkumarrelli@gmail.com \
    --cc=richard.weinberger@gmail.com \
    --cc=richard@nod.at \
    --cc=siva.durga.paladugu@xililnx.com \
    /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).