Message ID | 20180319155742.13731-175-alexander.levin@microsoft.com |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp2898086ljb; Mon, 19 Mar 2018 09:03:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELu87a3M5JLPx7asX6c8KSEjbAAzu9DiyYd9G+MMJJ+exVFyac/z2mQDtwYXN6X2qmE+j1fe X-Received: by 2002:a17:902:7716:: with SMTP id n22-v6mr12700316pll.268.1521475434402; Mon, 19 Mar 2018 09:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521475434; cv=none; d=google.com; s=arc-20160816; b=EYTFL7GkrmajzAfUaQgTVqWI9yWJequnZhavVl468xMQQGQS7bjciyg/VQ4XDcTmr6 3PlsQeJlDwnM/WXIWsvmLpcJXz/WjaIpA8cWNQeGdgm/2PDe2eEnd1pHDGRHo4298iuq smuMTSbG4k9sHYhimjQFkw9LETikvNEO3+b0tNxriQZQ0dx64RXi7840SeDqXwc6ke5Y d2KymQt7+LerWgVppPMzYkMflpf3Jr/vjui8gO2mGCP7QB7x2N1q+3FEVISaDBkk9IcX c0shtSC3hmkLK6SKk5ZclXOjsCHI0XGQyH6UxKaDC5c/7OlsKX4w0Wyp9y2ESEj1F+HT ab0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=7zlE5W9gItGkMZCouwsNf2IOb03X20RVdCi3+klF3r4=; b=ssBD8ddOXk0AwijnlUD6NBfGxO0f6SzX7rQJAv2DECbcfH1mVLntt7SaJb3+JYjLvj nuxi0XjhJdDDJNm5eOidMcq5jC5H7b5oaXd0h2+ORS/LjAxezYbeYOJPs6y+12kpM+K1 imwWOMKmWw/tyOWRcCkcY8fW5eYwv/HGJoINIU1h8GhxiPmRWk9mwPQOb9tmrPoqBlPy a1xqgJgvmOTXjDMe4VpJyQMVSLhyv9tpu/H2aQ/XaL4jti/hM5dUFsb64YFNVwyCcsNA boijD8+qWEJRQ1KEVlQm+4jBCaRaXkGJLd8UTZ2xsdphHa0mlJgBVxtXMMR5tSje8JBj Q4TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=G/IPfaZ/; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: <linux-kernel-owner@vger.kernel.org> Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si173366pgf.310.2018.03.19.09.03.50; Mon, 19 Mar 2018 09:03:54 -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=@microsoft.com header.s=selector1 header.b=G/IPfaZ/; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965599AbeCSQDs (ORCPT <rfc822;dan.rue@linaro.org> + 28 others); Mon, 19 Mar 2018 12:03:48 -0400 Received: from mail-cys01nam02on0139.outbound.protection.outlook.com ([104.47.37.139]:43744 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932923AbeCSQDT (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 19 Mar 2018 12:03:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7zlE5W9gItGkMZCouwsNf2IOb03X20RVdCi3+klF3r4=; b=G/IPfaZ/gMHtHMjEbwvIByuodkLwoi0lVGmOpa/tn3H5PbHdsCmRFcVit3XktqSTvX95CovCS4Di3HD2FqgVdEdpHj9/Gee7fDj0zqnxaOEfBcMGCnf16pNfKuVL4TjIL240VgtXDaRW8/yh3spN1g9n6PFfV6fxLctRGXs4FZ8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0725.namprd21.prod.outlook.com (10.167.107.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 16:03:13 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 16:03:13 +0000 From: Sasha Levin <Alexander.Levin@microsoft.com> To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "stable@vger.kernel.org" <stable@vger.kernel.org> CC: Masahiro Yamada <yamada.masahiro@socionext.com>, Boris Brezillon <boris.brezillon@free-electrons.com>, Sasha Levin <Alexander.Levin@microsoft.com> Subject: [PATCH AUTOSEL for 4.9 175/281] mtd: nand: check ecc->total sanity in nand_scan_tail Thread-Topic: [PATCH AUTOSEL for 4.9 175/281] mtd: nand: check ecc->total sanity in nand_scan_tail Thread-Index: AQHTv5uF4W3uZ3mFKU2+UKkRCyd0Aw== Date: Mon, 19 Mar 2018 16:01:20 +0000 Message-ID: <20180319155742.13731-175-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR2101MB0725; 7:ZwPvRxkBBEIK/UiTX4fpgwnhmzSU4opjIVx9096+07JuZJPcxZHHsLlkGS63RJ9jj9nOWcjNDdW0/6tM+HtRYUwmDyLQig9d2Ai7vVRGn99GVnrhDXKeb0+Jrhl2SrsbSBOXLrSk7qtJ36oed6yKkrhQC6p6yn4zLX7j2FiL5rsFxIMqV3pMFxC7nt2plFTsiMXLAeIf28Lkwr/nFBCHF57pr0n+CRukoC72QU5FtP1IrgKN5ei20Ulyn/nkpq38; 20:lMu4b/NEXJU66VGIVh6UrvCT6z4W8G0pQJnSaYrADd5RS7mU/b381xKSQu1d7FZnUZbHTiUObu8Yu7G3BfVOlA8RlHW1ERkNNSLQyCuy0ilMqzahsAkM/FKL5Dqp5adL/iWl/VWqERWBzTAkBhI3ThUNPsxSXn79cdKCcGlKwuc= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b1f2bed9-d19d-41b2-1597-08d58db2eb62 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:DM5PR2101MB0725; x-ms-traffictypediagnostic: DM5PR2101MB0725: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: <DM5PR2101MB0725AE09B6B3A9DA12908CB5FBD40@DM5PR2101MB0725.namprd21.prod.outlook.com> x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(58145275503218); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:DM5PR2101MB0725; BCL:0; PCL:0; RULEID:; SRVR:DM5PR2101MB0725; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(39860400002)(376002)(346002)(366004)(39380400002)(199004)(189003)(2900100001)(4326008)(54906003)(10090500001)(81166006)(316002)(2906002)(14454004)(110136005)(107886003)(6506007)(186003)(81156014)(22452003)(68736007)(53936002)(3660700001)(478600001)(5250100002)(2501003)(99286004)(36756003)(105586002)(6116002)(3846002)(5660300001)(72206003)(1076002)(2950100002)(6666003)(305945005)(6436002)(86612001)(66066001)(10290500003)(76176011)(97736004)(8676002)(7736002)(8936002)(6512007)(102836004)(106356001)(3280700002)(6486002)(86362001)(25786009)(575784001)(26005)(22906009)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR2101MB0725; H:DM5PR2101MB1032.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 5VdpbfzseeUrbtbo5pqR1ZzKmXEEFZGhdNLboK6dVmB2zqPSdfTtb5rXyoPshsp7GkTb9f2ZersOOS9g7+xkydROJ4fuhpHiSWAc0Zw/U96dml9WRGxdSF3TdiWdfu/8EP3uSYotlt50cR1u08ehYO+h/N5HK9tMgomVbx5pVbaigL0b064IVjxR2RYea0Uj6WVMVNmLj20/3lSlMCY8uEbJtPe0bbPNcgbUiypmju/EP3T0gMccJCnkoxENh3UB9nSZbu+wSduOk58phsnj+kA2xB96YQirpo0ITf2C8248vdcTXLn6XEJ59m2brWy6cf1xfFn64kNJ8ODG19yNug== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1f2bed9-d19d-41b2-1597-08d58db2eb62 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 16:01:20.3233 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0725 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 21c03086bb7f..3bfa8e0e44cf 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4780,6 +4780,11 @@ int nand_scan_tail(struct mtd_info *mtd) goto err_free; } ecc->total = ecc->steps * ecc->bytes; + if (ecc->total > mtd->oobsize) { + WARN(1, "Total number of ECC bytes exceeded oobsize\n"); + ret = -EINVAL; + goto err_free; + } /* * The number of bytes available for a client to place data into