Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1161891ybl; Tue, 3 Dec 2019 02:46:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwdpxGzp+qZ4MOGr7gAcehFtFF2mQNsFH2WHj20G0fH/uBjA1eEEW6zlXcl7WV1ZXowH5T0 X-Received: by 2002:a54:4595:: with SMTP id z21mr3132380oib.136.1575370008667; Tue, 03 Dec 2019 02:46:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575370008; cv=none; d=google.com; s=arc-20160816; b=PyqvUdWewqkvjBqz8ZwGwLvLJllGYgAQJpAHGDRLNE1NCek8fM4+anxaifJMhpI0Lo hZLAagplBQLFs2ilntmaBuj7syiZy8kDv+27DTugGjhqkj8bsj54m2NCdu/5iDIQa7nc T/15d4TSoCMQnKcbsJtmJ/mAM1kmVBq4WBD+0WbKerYiHbfVVSEgX2C3BYpXuXaTzybi r2ly/vqwquvKE4dO+4FgeXn0VUj8wP8EsZgxfSutEy88IguCM+zv75xhLpqsUDdTfXOG gRsaXV/vcgrGLOAp+WB1S/oEZ55GqjjPn6MhV0NA9BmMXXWT0LAHS51FjEC9h996dXv8 fG3A== 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=38iv7NIVQym1UC2pMZKk4YWtD+mcwvXsl+FShNgS280=; b=BVOOUCS9FTfD96Z9asghcmN8j1UBGJWh//ZmG55hjw8NioyYgU+MZiwMMahYMWsvO2 bpmOY4lFBUbYpk0Ed88ksdSdgS3w6vIN/GJwzDGy5sG6twhHRmJounIZRjxQG/gPR13j y5Cnh7XmxK32E/bABInbIKdtgpKWGEn3ydangXwleQbsKF1n2qkQtwxzHHwAmfiSiFe/ QN3w+rGdV2BUhLQJrUIh9cyW4tUgHM+yE5CdI5E6Ki0vvIvwba9GVEWOoW0vaowYg7s4 5ggHIEdPnXjpGzjx6OLzZANsPUFC2HehyNb9IKA1hYQTPeh8Szdm7d12o8lHxCm6daVa yExQ== 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 q26si1062273oij.38.2019.12.03.02.46.35; Tue, 03 Dec 2019 02:46:48 -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 S1726017AbfLCKqD (ORCPT + 99 others); Tue, 3 Dec 2019 05:46:03 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:54071 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725773AbfLCKqD (ORCPT ); Tue, 3 Dec 2019 05:46:03 -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 1ic5gu-000196-VF; Tue, 03 Dec 2019 11:46:00 +0100 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1ic5gs-0007aN-U8; Tue, 03 Dec 2019 11:45:58 +0100 Date: Tue, 3 Dec 2019 11:45:58 +0100 From: Sascha Hauer To: naga suresh kumar Cc: Richard Weinberger , Naga Sureshkumar Relli , Miquel Raynal , linux-kernel , Michal Simek , siva durga paladugu , linux-mtd Subject: Re: ubifs mount failure Message-ID: <20191203104558.vpqav3oxsydoe4aw@pengutronix.de> References: <20191203084134.tgzir4mtekpm5xbs@pengutronix.de> <614898763.105471.1575364223372.JavaMail.zimbra@nod.at> 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: 11:45:00 up 148 days, 16:55, 148 users, load average: 0.14, 0.11, 0.12 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 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); -- 2.24.0 -- 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 |