Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1694892ybl; Tue, 3 Dec 2019 11:11:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwURU3qwhsYcPM0qnjWAxtb3FK7nSJrrBp6rId8MIcXVK7Pc3RsSdnoGg0YJ403tC1kI72o X-Received: by 2002:a05:6808:64d:: with SMTP id z13mr5171380oih.104.1575400274218; Tue, 03 Dec 2019 11:11:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575400274; cv=none; d=google.com; s=arc-20160816; b=ZirJ7+Oa0/Q3OO+3Q1HnBVx8V1FbIogb68vGDLmNvVso7wUIPci0iosG1yA1RQv6Ec oA0BKh2DIx1RZ8d4aoddTevotrySbT02cu+j8ENDP60WjgFxLwgWpAcpR8Pe5eS3z8yE I/0XvRaVSza5zHoy/tbcrh0heCx2wJNGhm+vSWrD4Ceov5KGP1sf3xUxYx8+1YRhp9/4 LVCwDPcoPRlXZV2gMLuXKeqWjiiUZejxtZmIKMchRBQ1ciYYebrMAad8qbG8Ec2DoSFx yyhNZumVpwikTEQuei6HCr41eNqJaF9Dn5MubTGSo9KIKLfbpkq52FLq0C0sA1ysBXDZ oyxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=RgM6aRu1VoXAsJhtsKrEwRnmsLudyDcKIfYzB5q/ENA=; b=ORhkXIY5LU6fv9PNegpZxYaglzcTrKqhGt4YdcCZdQ6TBHf/ttryxBr+yzAVeYjPJq iKZ4A7nT1uclpagzyF7ZqCGAPVXbtcbRAHd6eDTF3921bn750b7DwT96v3NTVucf9ZSE UqoulT3PORZdMyCiyscowX+TzweGwQmHG3CUTiNHbRHMnfPyBSdx7q/vNiQu39caVPDN SSmrWF/6/kLWhGWn11+gAeK4WZL5PXyapF3a/tIRIP5JkpDE8rLid7wSBuQxCjQjKrX9 hL868khGpJ1E04QF7kBbeJCTR6HQKoHt1x5UfFMUGMPeuBxfW1sGl20fbt0RFtlEMYNC mPew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RA++pnfQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 188si1921555oig.197.2019.12.03.11.10.58; Tue, 03 Dec 2019 11:11:14 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RA++pnfQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727261AbfLCTJC (ORCPT + 99 others); Tue, 3 Dec 2019 14:09:02 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46751 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfLCTJC (ORCPT ); Tue, 3 Dec 2019 14:09:02 -0500 Received: by mail-wr1-f67.google.com with SMTP id z7so5060093wrl.13 for ; Tue, 03 Dec 2019 11:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=RgM6aRu1VoXAsJhtsKrEwRnmsLudyDcKIfYzB5q/ENA=; b=RA++pnfQwShG7t7eeG40JlPYoxkhxadW+dqsRuZCr/BhsDQCK9o5hB2E2bpg7qTKJ/ 9oekQYEXIUArmnqXmnVfJCY1Rr0MsY5B6JuafbGy+3RLUBtJPB73BaIqi8js28QsqL7i myoThZneq3PVu4p8XIUv14JEac3KKFYj0yPxTZcCE47r+uTlItCTKf/Z56R7zaIFIHAr XOM0QSpGFXG9CIo5HaS4BsaqPWtRALjNFrbubckDom/x57LESokOTQdg0RIUQ3EpJJ4Q xLiSA/iHgJXh34dm5KfLml+XMkyhQpl/X8WozhlLKc1amJKekI/i53DgwFUa4UXfO8J+ uqKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=RgM6aRu1VoXAsJhtsKrEwRnmsLudyDcKIfYzB5q/ENA=; b=Bq0VF9j45oUcMKqiKhT9qONpWUYYl4ohfSpUhoTodmBYNDaITfSpjjzF+W+LPsPxkc LzLmWp87QMTTay2OI06M2U1VlBPdTkRu+iEn8PZ2kPVLMRjVxnOh8oVX+2K6cJS0WTj7 vyKhCPdBFbpKw7TU7Idyy6vgcnoClq0v4NSbjYlyeg56BER+7Pgdqg8o4j6ZOsFhrjql Mr9xOgOBZJN3GT7ugltqDo/5eRQYb/9vXpb6MlsC2wHDrCHc8wBO0gWUDtH9DlV8ng0T W/pJPW2Knq+Aool2yM9dMT4SmfgxWXms2ZvUSLtNFUutbJk0C7+WBIpNe8QeBGfoZOMr ytIg== X-Gm-Message-State: APjAAAXUaJ6oJ+xIgkfJ/pBseQlvc35N9m5Zv05vxOY2A0nuy9yI15a4 YKi5Wlxbh2RRKBgDXhG0ciPwdEj0WSlgzzZm0S4= X-Received: by 2002:a5d:480b:: with SMTP id l11mr7069833wrq.129.1575400139644; Tue, 03 Dec 2019 11:08:59 -0800 (PST) MIME-Version: 1.0 References: <20191203084134.tgzir4mtekpm5xbs@pengutronix.de> <614898763.105471.1575364223372.JavaMail.zimbra@nod.at> <20191203104558.vpqav3oxsydoe4aw@pengutronix.de> In-Reply-To: <20191203104558.vpqav3oxsydoe4aw@pengutronix.de> From: Richard Weinberger Date: Tue, 3 Dec 2019 20:08:48 +0100 Message-ID: Subject: Re: ubifs mount failure To: Sascha Hauer Cc: naga suresh kumar , Richard Weinberger , Miquel Raynal , linux-kernel , Michal Simek , linux-mtd , siva durga paladugu , Naga Sureshkumar Relli Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 wrot= e: > > > > > > ----- Urspr=C3=BCngliche 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_inf= o *c) > sup =3D kzalloc(ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size), GFP_KERN= EL); > mst =3D kzalloc(c->mst_node_alsz, GFP_KERNEL); > idx_node_size =3D ubifs_idx_node_sz(c, 1); > - idx =3D kzalloc(ALIGN(tmp, c->min_io_size), GFP_KERNEL); > + idx =3D kzalloc(ALIGN(idx_node_size, c->min_io_size), GFP_KERNEL)= ; > ino =3D kzalloc(ALIGN(UBIFS_INO_NODE_SZ, c->min_io_size), GFP_KER= NEL); > cs =3D kzalloc(ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size), GFP_KERNE= L); Oh, looks good! Thanks for fixing, Sascha! Thanks, //richard