Message ID | 20180717042150.37761-7-keescook@chromium.org (mailing list archive) |
---|---|
State | Not Applicable, archived |
Delegated to: | Mike Snitzer |
Headers | show
Return-Path: <dm-devel-bounces@redhat.com> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D62BF601D2 for <patchwork-dm-devel@patchwork.kernel.org>; Tue, 17 Jul 2018 04:22:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA5872223E for <patchwork-dm-devel@patchwork.kernel.org>; Tue, 17 Jul 2018 04:22:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE87D2522B; Tue, 17 Jul 2018 04:22:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6A6E123794 for <patchwork-dm-devel@patchwork.kernel.org>; Tue, 17 Jul 2018 04:22:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE2CC308FB9E; Tue, 17 Jul 2018 04:22:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4C825D9D1; Tue, 17 Jul 2018 04:22:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7710B4A46E; Tue, 17 Jul 2018 04:22:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6H4M3ST000691 for <dm-devel@listman.util.phx.redhat.com>; Tue, 17 Jul 2018 00:22:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 59354CAE94; Tue, 17 Jul 2018 04:22:03 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52D7CCAE6A for <dm-devel@redhat.com>; Tue, 17 Jul 2018 04:22:01 +0000 (UTC) Received: from mail-pl0-f65.google.com (mail-pl0-f65.google.com [209.85.160.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B4ADB3084033 for <dm-devel@redhat.com>; Tue, 17 Jul 2018 04:22:00 +0000 (UTC) Received: by mail-pl0-f65.google.com with SMTP id 31-v6so16237776plc.4 for <dm-devel@redhat.com>; Mon, 16 Jul 2018 21:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8YjMcInXJrnMY6NIy0rzHFpjLepbrpMxKQdqxE6spGc=; b=Bl4PyH5O0iBK/KBUspRFI9jqAFWVLoYggS6GlmSQWSKD6k7QMIXU9QPXSUiKp34N5t QpBFYfZu8ncmutceKRu+/RJUeFCL5Zue4A9/uE6vwCyUbVvouRHjcidff+4lxWtI9ThZ RvmLtrw65zyKPohYblxh7ZgDEAdf2eF++Okk0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8YjMcInXJrnMY6NIy0rzHFpjLepbrpMxKQdqxE6spGc=; b=B0VjkwGbvVDl5Dc7Goa67cV/ywYleY3FsHjn9v+lJB1umApiqjebxXM7kR3ILPNjEG 0SHB58hitvM6L2c9Cyv6vO5pOx+vIIoKl4p5Rd89S6gscrIhxGrhOdtW7nuLEQ3IX+Qy HeYGh52OjxSgmN+RnRSxPVDPgS3c0xCRikFq/OvEH5xhlkva1rDddmVHrvD1kN8FNqjq Sk6p1Fr6Whpb94HZ34SXcb8/WROrdJmrEs5aOyFaEgehHw8GAlSfTNPAbmSjZYHwFVFM xY+cy23iZuYVLY7VViZyzdjP9lAkzlt+eako9G88UTYwZrGRUNHqZ0tPq+FH7Bh5qXI+ kmDw== X-Gm-Message-State: AOUpUlH25fRPVChAb/adkfDMYDVfUDJBLHwkI/ABVSWyRtlduwaWy/hG +osrz2g/fOMI8gRHMz1nyJ5b3w== X-Google-Smtp-Source: AAOMgpcIrVTauvZOWWhT1QnQca6SiTA3kYMd6lRP49OSThBVAAgWP9FffU7cyXpYzxAWQf2VgmbDrQ== X-Received: by 2002:a17:902:6a89:: with SMTP id n9-v6mr15834plk.302.1531801320240; Mon, 16 Jul 2018 21:22:00 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id 65-v6sm46918384pfq.81.2018.07.16.21.21.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 21:21:58 -0700 (PDT) From: Kees Cook <keescook@chromium.org> To: Herbert Xu <herbert@gondor.apana.org.au> Date: Mon, 16 Jul 2018 21:21:45 -0700 Message-Id: <20180717042150.37761-7-keescook@chromium.org> In-Reply-To: <20180717042150.37761-1-keescook@chromium.org> References: <20180717042150.37761-1-keescook@chromium.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 17 Jul 2018 04:22:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 17 Jul 2018 04:22:00 +0000 (UTC) for IP:'209.85.160.65' DOMAIN:'mail-pl0-f65.google.com' HELO:'mail-pl0-f65.google.com' FROM:'keescook@chromium.org' RCPT:'' X-RedHat-Spam-Score: -0.131 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.160.65 mail-pl0-f65.google.com 209.85.160.65 mail-pl0-f65.google.com <keescook@chromium.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: dm-devel@redhat.com Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>, Kees Cook <keescook@chromium.org>, Arnd Bergmann <arnd@arndb.de>, "Gustavo A. R. Silva" <gustavo@embeddedor.com>, Mike Snitzer <snitzer@redhat.com>, Eric Biggers <ebiggers@google.com>, qat-linux@intel.com, linux-kernel@vger.kernel.org, dm-devel@redhat.com, linux-crypto@vger.kernel.org, Lars Persson <larper@axis.com>, Tim Chen <tim.c.chen@linux.intel.com>, Alasdair Kergon <agk@redhat.com>, Rabin Vincent <rabinv@axis.com> Subject: [dm-devel] [PATCH v5 06/11] dm verity fec: Remove VLA usage X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development <dm-devel.redhat.com> List-Unsubscribe: <https://www.redhat.com/mailman/options/dm-devel>, <mailto:dm-devel-request@redhat.com?subject=unsubscribe> List-Archive: <https://www.redhat.com/archives/dm-devel> List-Post: <mailto:dm-devel@redhat.com> List-Help: <mailto:dm-devel-request@redhat.com?subject=help> List-Subscribe: <https://www.redhat.com/mailman/listinfo/dm-devel>, <mailto:dm-devel-request@redhat.com?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 17 Jul 2018 04:22:31 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c index 684af08d0747..fe5cfd1a5fa5 100644 --- a/drivers/md/dm-verity-fec.c +++ b/drivers/md/dm-verity-fec.c @@ -212,12 +212,15 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io, struct dm_verity_fec_io *fio = fec_io(io); u64 block, ileaved; u8 *bbuf, *rs_block; - u8 want_digest[v->digest_size]; + u8 want_digest[AHASH_MAX_DIGESTSIZE]; unsigned n, k; if (neras) *neras = 0; + if (WARN_ON(v->digest_size > sizeof(want_digest))) + return -EINVAL; + /* * read each of the rsn data blocks that are part of the RS block, and * interleave contents to available bufs
In the quest to remove all stack VLA usage from the kernel[1], this uses the newly defined max digest size macro. Also adds a sanity-check at use-time. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com Signed-off-by: Kees Cook <keescook@chromium.org> --- drivers/md/dm-verity-fec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)