Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3065705imm; Sun, 1 Jul 2018 11:26:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIsjeTkhpE0cSrva2snKY+Xho+rQCTeF2y2kGPr0WO3aw6wliqjeBoPme1MztJltHMTTrgi X-Received: by 2002:a17:902:bc85:: with SMTP id bb5-v6mr22991508plb.229.1530469586224; Sun, 01 Jul 2018 11:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530469586; cv=none; d=google.com; s=arc-20160816; b=jy3buWkOqzZqE14iAeXO0V26NP5/1tb6Gv5qXUVQ2ViqKWJegxeQOoTM+k2NAsxrlo p9JEi9Bvz+mJXHoAh3KKj7sAs8ziwCJ/CzvfzM43gHQ7rdWOVD75IKs57QWPmAaZaWkp v6TVDZw9k/w7y2iA61+HefPRJkXOYbvkaCUO9vtXtYG/e9ViJJB67CVlAm37RasCYreu lOLB6ZBX4LRDsWmKtnst2phUWmdBxpRmRz8M+PMLqTGmjW/C3C4S6ZnKUnwa2UqyU/A0 /SrBHcMMoW3Yp3/iBTRMmEUjWAfOg6FxEXjneOuWHgHlX2EzKmiAmswh142d26rEaffV 9f6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=z0fc6u2sQcy3ReDoaDemsobenf8JDLKkVJ52EHSQNWY=; b=pl7Inv7XRlTI5s0Ewx57kIqYGFuLyjdLSGTtP7yOqmMe4Mc8UWyltW8BpqATGVC0jk XbOoxWwq87sz0xRXxv+oPHiq3CaX8c3QwkoQ+t3xz1PGDX0eUTahEk7N50lotB0Fgw36 NW0cfuIft+MzC6+gle1+7O/ogSwJ3wVLQjkRuFsAIHkoPaYmM/d8gE3VAbC590BgxcLf +m5zSf9cFg2ZZGG9REBSq4XRUH87DaQI23as/T50VhNBmQaPqSCoI+ZKK9BCFjolHaaN ZulJW8jv/ojSWTakDj/J4MHX+Xn96UxwTXyqEN7t3jiHD7uJQni2q/Q+v47UIb8SP4wh a/Kg== 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 3-v6si14075830plx.351.2018.07.01.11.26.12; Sun, 01 Jul 2018 11:26:26 -0700 (PDT) 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 S965218AbeGASY6 (ORCPT + 99 others); Sun, 1 Jul 2018 14:24:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33066 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753357AbeGAQSk (ORCPT ); Sun, 1 Jul 2018 12:18:40 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8995249B; Sun, 1 Jul 2018 16:18:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Silvio Cesare , Kees Cook Subject: [PATCH 4.4 074/105] UBIFS: Fix potential integer overflow in allocation Date: Sun, 1 Jul 2018 18:02:24 +0200 Message-Id: <20180701153154.790996901@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701153149.382300170@linuxfoundation.org> References: <20180701153149.382300170@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Silvio Cesare commit 353748a359f1821ee934afc579cf04572406b420 upstream. There is potential for the size and len fields in ubifs_data_node to be too large causing either a negative value for the length fields or an integer overflow leading to an incorrect memory allocation. Likewise, when the len field is small, an integer underflow may occur. Signed-off-by: Silvio Cesare Fixes: 1e51764a3c2ac ("UBIFS: add new flash file system") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman --- fs/ubifs/journal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c @@ -1107,7 +1107,7 @@ static int recomp_data_node(const struct int err, len, compr_type, out_len; out_len = le32_to_cpu(dn->size); - buf = kmalloc(out_len * WORST_COMPR_FACTOR, GFP_NOFS); + buf = kmalloc_array(out_len, WORST_COMPR_FACTOR, GFP_NOFS); if (!buf) return -ENOMEM;