Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp129668ybl; Tue, 3 Dec 2019 23:19:05 -0800 (PST) X-Google-Smtp-Source: APXvYqxTzxylwrw9oE4U+IE4vhKot9kcZMksz7jiF/qA29lHmQ2soFi+zFKzS99X2daJ52aq6hqQ X-Received: by 2002:a54:4511:: with SMTP id l17mr1457333oil.91.1575443945262; Tue, 03 Dec 2019 23:19:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575443945; cv=none; d=google.com; s=arc-20160816; b=s/jfLAlyKxhmtOPgn+DAkT2kBE8mkpmt8WEdT3XTbegbkFqLxWJ6i82uMwlONyEs1p BzbqH/AWBprFGugyZtZAS/9oEYVLazUNLCpf/wYqrCDRnE3nyhBG1BmMcE0vRU9arGuY IaCGvwd47O/WQ86wUu1r7KMsHvZisNiQUkqrDjnKNyH6pYb97nUdS/OVBziASZwY/F10 voPw8b6kCf56Ff/m7TsLJOIrf2/Wm+mUQ870kNzj6HmS5jF0sPMaj5Wwz1ZTVgdqO+K1 bvUtdmjSdUb5xViXEsy2cDLAwJ+UWRGrWpxdlP6LEsLQUrq18BQBdB2DxIIWlWFLiRhX vdWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=5wxs4vw+2uJCa+H6t1JdoKpw5Hzn72VEV4GMhypwLnY=; b=CHNGgYtcejWy2k4qLdFaAHFicMZGvkjP3Iv2d9ouLlBL5f2JfkWVym4uQjx/Vk8UWH WhTi8PMA5cfb3qPCRhmVf8EtuG/UrG4Jy61svHOk+kHs1J5QyGUQZYX2RvmK/LZn5jYe BOoutObxz/El6EHuIWjscyaEVBa5LTzk8otAzM2nCvyTZ7j15WG25lFGoqqxqPFySb7o 8+r45TBQLAUcTTOJojjgF+PXYWlVX6dVawzYrzptyxqnB/lFJPOe5RGyJwlyeTvwtnog udh0bLtlIMMCekPcd2KBNtPYGN6IoY6TTz3exEd50WF37bdhGoa1MdIh/tS8gXQsXVFq rR4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2si3018768otb.4.2019.12.03.23.18.53; Tue, 03 Dec 2019 23:19:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727228AbfLDHRu (ORCPT + 99 others); Wed, 4 Dec 2019 02:17:50 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:54831 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfLDHRu (ORCPT ); Wed, 4 Dec 2019 02:17:50 -0500 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1icOux-0003vA-St; Wed, 04 Dec 2019 08:17:47 +0100 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1icOuw-00075T-Cc; Wed, 04 Dec 2019 08:17:46 +0100 Date: Wed, 4 Dec 2019 08:17:46 +0100 From: Sascha Hauer To: Richard Weinberger Cc: naga suresh kumar , Richard Weinberger , Miquel Raynal , linux-kernel , Michal Simek , linux-mtd , siva durga paladugu , Naga Sureshkumar Relli Subject: Re: ubifs mount failure Message-ID: <20191204071746.kfdflui4ziladmjg@pengutronix.de> References: <20191203084134.tgzir4mtekpm5xbs@pengutronix.de> <614898763.105471.1575364223372.JavaMail.zimbra@nod.at> <20191203104558.vpqav3oxsydoe4aw@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 08:17:13 up 149 days, 13:27, 126 users, load average: 0.16, 0.23, 0.21 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 03, 2019 at 08:08:48PM +0100, Richard Weinberger wrote: > On Tue, Dec 3, 2019 at 11:46 AM Sascha Hauer 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 wrote: > > > > > > > > ----- Urspr?ngliche Mail ----- > > > > > Von: "Naga Sureshkumar Relli" > > > > > 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 > > 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 > > Signed-off-by: Sascha Hauer > > --- > > 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 |