Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3080987imm; Sun, 1 Jul 2018 11:50:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdO28D81uYJG0dkQnUx3uj055rPDe6srLOZLliHAz6lZ6x3JmfvTkzOvShiEEgDIe3niYBC X-Received: by 2002:a62:6147:: with SMTP id v68-v6mr13878191pfb.115.1530471003021; Sun, 01 Jul 2018 11:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530471002; cv=none; d=google.com; s=arc-20160816; b=dQURhty58SKYhrb6H5k8fzdZRjv3wtXo9Tj3oeI2yy6Btc8bESeqzbNn3fdQNAeYHs 4TNuisNmjaPFMFox6WtyHtE/QIo/ioY12Sa4j5I8jx/P+epO9NMzGWAyhxLFN4X18dM9 9hvlQV0MSDTVfb4jmty4WhnGSdNOd1zCBnWidBTOknvQoTLb0zfYlE5yqU7vNlS36l47 6kMspWtmQC5jImjx80PgRlh2MFMSRxIq5lyM+KYm4kUYvXtG/HE9DNTxa6XTYlPAHcfc UreIBECDsPh9rXDXDS65gfcE/aqsWxwyWReSu2pbNTabZahqVuqkVafTB+kAVxjVZTkJ U5hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=X8dhn6dNj1jyb6xmkUVr+jL+mGI6H9EgdPgJYxlWWYI=; b=D279kOEHjya7+tFEQjRbM/jfsB9Jf+7JVSgi1HW8PwOedQp9pl7kJBESBKN0LRzMcM VS+4JeeRqf/6oDN0q/t+1+c5SrtzvO0Y9h4ibcy3Sv9XdwZ/bL8xp24IcEYAYxhzAbwN mImoYacTyxjFemBibmoHBP0qSeKS36W4P5fX7IzcHZlZ3itPV+o5+zwZWUPo5cvoMOu0 VaT+GsM4B/V+07HTtNUlFLs4Y+2q4WHpx0OTHipDma4gic63XM3L1hA3s1rgyGCLYPba A4h3BduslhSWwwLBGqGwIxa4/wLECK6m4erpUBzwJI0RtOyvYKSRMkEIx/dr0/W56z1n yuFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bPBxQAmf; 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 z11-v6si12720217pgz.264.2018.07.01.11.49.48; Sun, 01 Jul 2018 11:50:02 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bPBxQAmf; 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 S932156AbeGASsN (ORCPT + 99 others); Sun, 1 Jul 2018 14:48:13 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:46136 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932093AbeGASsJ (ORCPT ); Sun, 1 Jul 2018 14:48:09 -0400 Received: by mail-wr0-f195.google.com with SMTP id s11-v6so4121483wra.13; Sun, 01 Jul 2018 11:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=X8dhn6dNj1jyb6xmkUVr+jL+mGI6H9EgdPgJYxlWWYI=; b=bPBxQAmfdnsLmWGdHhZza0Y3ZIlCNituFqGcOW52mmTDfzG/OahZdwlPCkmR0QSj/U lYdOi1VnN5FogqTiOCpZY5lIW6Wm3Odp0Cll5cjfqSi+ib4oCDwFjv4d8wkzTkkenw+u PT/z6Jrm9KKH1EqkNLgWCzkuFMaYF69h4eDyokp/eV3/LLZ0ZXgtEtTwU6k0VKDKWX6m CpMbPNEHxt1GlrzKYC92kzPmQRCAYbRP7PbZ12f8KNtLureipP8U9NWZkFBb49/FlPGA ajUHp64QJcbW7rRuvdYVYepkIbpRNqPztGmWBO05AsLrIS9pT4k/5u5boERi2Y8452r0 H+Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=X8dhn6dNj1jyb6xmkUVr+jL+mGI6H9EgdPgJYxlWWYI=; b=T1/W/nB0g9RqL4+mbk9rThu/R0CXVO4MgbTICizlLuRyB38tGP1y70Ded6/bdONFEy 0pru5jx2ltO6PQ026Xy9kRkltOe1R846qMg2lvb9adEFzuTXlwsqjpUv5myepsXORvwC NsLng7B9PQaxdmyEMs31EhqSHRv6AgUxuc2/RwtpOhOg1LrPzveig9CwUTWLlX5KsAMV bqbf6VOSRJAdsCs7b3yavF8PsElqBavWX1GfvcVn3aIOWk7kJltenoPXqKe9UHHDpbSY duPS0BuSIaaeoVWpt5VFeHurMJbpjsd5+79RJ56IRyPhYeiznyZzOflka7zYZZtotF5/ C1EA== X-Gm-Message-State: APt69E1b2lD/ZpwJWl7tHI2pnDnZni6TlGiWnUx6tLu/q+bspeAKFPzV /8uQAzZcIkj3jYoqJHrobDDZSde2ZwZLYQgy+xk= X-Received: by 2002:adf:e0cc:: with SMTP id e12-v6mr9664681wri.199.1530470888313; Sun, 01 Jul 2018 11:48:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5d:480b:0:0:0:0:0 with HTTP; Sun, 1 Jul 2018 11:48:07 -0700 (PDT) In-Reply-To: <20180701160914.723817814@linuxfoundation.org> References: <20180701160908.272447118@linuxfoundation.org> <20180701160914.723817814@linuxfoundation.org> From: Richard Weinberger Date: Sun, 1 Jul 2018 20:48:07 +0200 Message-ID: Subject: Re: [PATCH 4.17 154/220] UBIFS: Fix potential integer overflow in allocation To: Greg Kroah-Hartman Cc: LKML , stable , Silvio Cesare , Kees Cook 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 On Sun, Jul 1, 2018 at 6:22 PM, Greg Kroah-Hartman wrote: > 4.17-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 Guys, this patch was never on linux-mtd nor was I CC'ed. I don't see it so super security critical which argues to bypass the whole community review process. Anyway, I don't like this patch for two reasons. 1. Instead of doing the kmalloc_array() dance, just check whether size is 0 > and <= UBIFS_BLOCK_SIZE, in the caller. 2. It will not apply to most stable kernels since it targets the code path with UBIFS encryption available. -- Thanks, //richard