Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3688444ybv; Mon, 10 Feb 2020 04:44:33 -0800 (PST) X-Google-Smtp-Source: APXvYqw2ImZVuo+NCNocbQdqBZfG94cRjaNu/wcfEgma7iG2aSGcpCSZilejfQNImCM+A69G6gGF X-Received: by 2002:aca:f20b:: with SMTP id q11mr680001oih.78.1581338672903; Mon, 10 Feb 2020 04:44:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581338672; cv=none; d=google.com; s=arc-20160816; b=Am99WirAvK/6pHI9pldEI6GyLmupuFKLjR21cLkGoCWxE6rQHHh2217hlA/VkBOqGm UFmHaR8EpscIoIaHl04w8N24zqcEhBDZJJfXwC0hupm6WUN9BB+N4/lfddmRwi7VhzKs z5nhjOUdJhbKIqXG8Cy/c4+aZ5gBK7PpWe0+6/xGagNMs+jqgBbRpYmF8FOLJsSYatlM wOzqn+8LQo/XV8tn7i82Ng6CL2uvaqk2pr/JktfMqyTkXjqPKSZMqvDTmepESIf9z8r/ lfDOd0wybWsYokAVcWt+s1jnlHBJaSDFWu7Xit8RACuo5m+A1awV4WP833XQu6v2SqWM 4YBg== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=obfC1Dcrd2pgRy0dw2tOpX4+deU9BNwc8uFzLZBnkLU=; b=zQwsX2+17mwnXa/WpobP74ekTGfvFw5MfDMX4LuArl5/6zB9fYGf5i/93qle/x0U6Y PU2n9+SYUHn8KYWQzG/NMzUPdIVjezSk8MZyTRVPDwFG45P0ZdMEdi8kHYlmmrobw4Y6 BjRouCiR7KuDJF1lAV+IwQly90fRU407QNF1zwXWv56BC4ccxa5cdRl35rMkctwTC/jg TlgjZ2ckO5F+ASV5Hu/bRaunyZ2XCwiS4r2u5gkJ39H8cgcwPoB3+Wyrv9rkeo20Bwd0 4/KyJdc4LcALvWEx9rNM+JfKuHacXOx6PGlN8iH5+zhFtmqVap6tvdp+uaNQ9AoswZCf RQSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M91AsGPO; 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 f4si135562oto.169.2020.02.10.04.44.21; Mon, 10 Feb 2020 04:44:32 -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=@kernel.org header.s=default header.b=M91AsGPO; 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 S1730467AbgBJMnh (ORCPT + 99 others); Mon, 10 Feb 2020 07:43:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:39086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729606AbgBJMkE (ORCPT ); Mon, 10 Feb 2020 07:40:04 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DE25C2467A; Mon, 10 Feb 2020 12:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338403; bh=9sL3KvbCb2vGm3OP5jNO94CpgQ5x9Mz8ykRB6AKRlLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M91AsGPO6NjJbnQDFWYmC0HVDdYwmAwAkiuox9W03UeHjAnwqfVQ8URW0Zbk89yy/ GK8dECAl+2lRnE2uzHNef3zp/bEehpmnC4y1GBjy7NigfTJUnK5Ht6VSsd/NGpYBhh jRTnqf6wEpNjRuemaRHGPcdhgO7+o4/P9ZpacWec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naga Sureshkumar Relli , Sascha Hauer , Richard Weinberger Subject: [PATCH 5.5 103/367] ubifs: Fix wrong memory allocation Date: Mon, 10 Feb 2020 04:30:16 -0800 Message-Id: <20200210122433.887802292@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sascha Hauer commit edec51374bce779f37fc209a228139c55d90ec8d upstream. 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()") Cc: stable@vger.kernel.org # v4.20+ Reported-by: Naga Sureshkumar Relli Tested-by: Naga Sureshkumar Relli Signed-off-by: Sascha Hauer Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/sb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c @@ -161,7 +161,7 @@ static int create_default_filesystem(str 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);