Message ID | 20180711203619.1020-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 0E899603D7 for <patchwork-dm-devel@patchwork.kernel.org>; Wed, 11 Jul 2018 20:36:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D33C3293FB for <patchwork-dm-devel@patchwork.kernel.org>; Wed, 11 Jul 2018 20:36:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D116A2932A; Wed, 11 Jul 2018 20:36:53 +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 AB61429429 for <patchwork-dm-devel@patchwork.kernel.org>; Wed, 11 Jul 2018 20:36:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CCAC95F727; Wed, 11 Jul 2018 20:36:51 +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 89DB45C582; Wed, 11 Jul 2018 20:36:51 +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 479CF14B0C; Wed, 11 Jul 2018 20:36:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6BKaW3N014827 for <dm-devel@listman.util.phx.redhat.com>; Wed, 11 Jul 2018 16:36:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id ED5AB308BDB2; Wed, 11 Jul 2018 20:36:32 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4ADC308BDB0 for <dm-devel@redhat.com>; Wed, 11 Jul 2018 20:36:30 +0000 (UTC) Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) (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 83C49308330B for <dm-devel@redhat.com>; Wed, 11 Jul 2018 20:36:29 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id s21-v6so19155806pfm.6 for <dm-devel@redhat.com>; Wed, 11 Jul 2018 13:36:29 -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=bLg1K1y9hKUijmDINfS3ouKcfvNy5+d5wjgDXlVueRbtbelbFfbmrUR0U21ix2fhqT 4Lp9lX3OakQPNShWhJWI0SuhscDEO456y+sxZi2JMMcVX7yfTI28e9IPvRfV6UvJSIuD wz0HIpWhCNy5e+v0NdScG0G4Rgn8kc+bFROus= 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=qVa7/rPJIX1zawgE4afWIrOPyuoKdbIML4S6DRlw52qPLaNJUeZxiPflC6okpOMYUn qLEfT/bOswbrfOLcYptSmm0Tv2WCfIT4ME7HIZaSKoRy7AaJQkvvizbRXeJpGcMXXOLf LsNk7NyHYl9eWr67vv/LigmRjJOzmUVf8z8Z57+3x7WMUYYZJQHf5HEWKFN2RsG0yZHk BY9g1SciVupcKdx0cgeHM33RzxUr64sp9k8fIfin8iqLzQhxWZE76yOxLWBKk0x/VnAS zpTtwjNjhGEvyac8LmblRHArPLeOcri7u9XseTwbK51Z53FLPlNMOu9PnGZ5LrdS+8uq 6T7Q== X-Gm-Message-State: AOUpUlHM6W05TirsF8WpU1mEljlqQ8xAfeNBMmGiXnHzxrb3bzfYrvtk dgvMKlPeuIw6dBIkyowusPHLYw== X-Google-Smtp-Source: AAOMgpdq8mhOY2Hzr/yGTT55d4Jq7NY94UD13bnGGGnvwb73W/D5oA6Uxq+EzLp3sRlLGHyoDXS+aw== X-Received: by 2002:a63:40c7:: with SMTP id n190-v6mr151000pga.116.1531341389075; Wed, 11 Jul 2018 13:36:29 -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 d7-v6sm34989618pfa.51.2018.07.11.13.36.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 13:36:28 -0700 (PDT) From: Kees Cook <keescook@chromium.org> To: Herbert Xu <herbert@gondor.apana.org.au> Date: Wed, 11 Jul 2018 13:36:11 -0700 Message-Id: <20180711203619.1020-7-keescook@chromium.org> In-Reply-To: <20180711203619.1020-1-keescook@chromium.org> References: <20180711203619.1020-1-keescook@chromium.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 11 Jul 2018 20:36:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 11 Jul 2018 20:36:29 +0000 (UTC) for IP:'209.85.192.193' DOMAIN:'mail-pf0-f193.google.com' HELO:'mail-pf0-f193.google.com' FROM:'keescook@chromium.org' RCPT:'' X-RedHat-Spam-Score: -0.112 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.192.193 mail-pf0-f193.google.com 209.85.192.193 mail-pf0-f193.google.com <keescook@chromium.org> X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: dm-devel@redhat.com Cc: Giovanni Cabiddu <giovanni.cabiddu@intel.com>, Kees Cook <keescook@chromium.org>, Arnd Bergmann <arnd@arndb.de>, Eric Biggers <ebiggers@google.com>, Mike Snitzer <snitzer@redhat.com>, "Gustavo A. R. Silva" <gustavo@embeddedor.com>, qat-linux@intel.com, linux-kernel@vger.kernel.org, Masahiro Yamada <yamada.masahiro@socionext.com>, dm-devel@redhat.com, linux-crypto@vger.kernel.org, Lars Persson <larper@axis.com>, Tim Chen <tim.c.chen@linux.intel.com>, "David S. Miller" <davem@davemloft.net>, Alasdair Kergon <agk@redhat.com>, Rabin Vincent <rabinv@axis.com> Subject: [dm-devel] [PATCH v4 06/14] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 11 Jul 2018 20:36:52 +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(-)