Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3428382imu; Sun, 11 Nov 2018 14:53:31 -0800 (PST) X-Google-Smtp-Source: AJdET5d7fM3WnhNUoo72M5k67x3dBZAFzj8GY8TRSGzT4YdGYh/OeCry85rU/bIqIBGg+hTjifkI X-Received: by 2002:a17:902:8c89:: with SMTP id t9-v6mr17820089plo.336.1541976811837; Sun, 11 Nov 2018 14:53:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541976811; cv=none; d=google.com; s=arc-20160816; b=ri3Gugk8OWUHM0mqVOVrtnaxj7ppL/7Hn5fkmEt2bthih/M9T4hdgkkNrgt9DEkjrX WfABvXpMt6q59cYX32LreJPc59HQ5KZWhRXbZ99tAYnwpwqma4LTmsK0upu++n9L34j9 oZNAr4oi/3Op2qsNn0G8EgVCizPXh2mnAr2XnwUA0OHqY+uBpuSQVAMbd3QrFkgdBDut Tb79DpVvf7g+mT6wlPfkfSFZboTw1Zq+HsYhaqJNgU35ZYFw7hGNqyOlDp5zyh6siy6G LJELJerY5tSCO7aBH02sZMEc9dK7iHvm8nE4yGxmCKTPXArMJcQFSe25Gma5dyP8+Doo ja1w== 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=jLCwEVl2GhepZwJ86nvwmah82brNMpHBYTCgEfLELIA=; b=D8axxuXv47FIgk3Y4hAN/3GnfVd7nXodVCxyCEqv8MbKDZIU/6zglM+ECNZz66fRQY +M2Nf5rntCnjcRMRKLVg3Tjuu8/rfZ7qxYZzX2c2u0LG2h24NmiKnLETIjKJ+QQ95kcz KrkVX3g8Zt84QfgEHWER9dR0B6OiwiCMLs0p8i6Pn3CY9243HfwRN19Sf4ITMaWD1SKT /MPhZI7Thzvuwq3m0C0cZmHBz+TBTWD+J2YG4F4aNTVod839iQlRo+0IcvWu30mfm9kq sQ0zYBYJLlmk+6affI54YeasfVMTRgCSMYPXoOi0LqQsvSfHguHhVAe7MG3PZ0o+iWn4 49WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WC+zo+uB; 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 w15-v6si17449503plk.269.2018.11.11.14.53.16; Sun, 11 Nov 2018 14:53:31 -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=WC+zo+uB; 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 S2390939AbeKLImy (ORCPT + 99 others); Mon, 12 Nov 2018 03:42:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:54672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404060AbeKLIXD (ORCPT ); Mon, 12 Nov 2018 03:23:03 -0500 Received: from localhost (unknown [206.108.79.134]) (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 87FB3223DD; Sun, 11 Nov 2018 22:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975586; bh=Y/LXwDTGXMFfQUQo2SEuiXb7Rmdx4wCHgzaobetpPQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WC+zo+uBn3rAXy6V5x5JpTJ7/ZRQp/tdKtncIKfpikd+avT81t0VcL9JQA/UwGDwA orjCAJJrcGWHgN3zl8kd9Hs3uIqtHAhGR8BvltwV4MOn5wnk9NEb0FWIiryGYhLq2D B4ocjsCKZJpAv52nQiGMdkfzT+LqMytQHvBXUPF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anatoly Trosinenko , Nicolas Pitre Subject: [PATCH 4.14 191/222] Cramfs: fix abad comparison when wrap-arounds occur Date: Sun, 11 Nov 2018 14:24:48 -0800 Message-Id: <20181111221703.985213012@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicolas Pitre commit 672ca9dd13f1aca0c17516f76fc5b0e8344b3e46 upstream. It is possible for corrupted filesystem images to produce very large block offsets that may wrap when a length is added, and wrongly pass the buffer size test. Reported-by: Anatoly Trosinenko Signed-off-by: Nicolas Pitre Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/cramfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -186,7 +186,8 @@ static void *cramfs_read(struct super_bl continue; blk_offset = (blocknr - buffer_blocknr[i]) << PAGE_SHIFT; blk_offset += offset; - if (blk_offset + len > BUFFER_SIZE) + if (blk_offset > BUFFER_SIZE || + blk_offset + len > BUFFER_SIZE) continue; return read_buffers[i] + blk_offset; }