Received: by 10.213.65.68 with SMTP id h4csp1180608imn; Sat, 7 Apr 2018 20:26:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/HW8qq4dqiYZZAowxf1PJHVOVXM4dm0CHWha4hNDaM+XhVzoT/B56WlZ1pqaAripOswIGZ X-Received: by 2002:a17:902:8ec8:: with SMTP id x8-v6mr34151309plo.179.1523158001172; Sat, 07 Apr 2018 20:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523158001; cv=none; d=google.com; s=arc-20160816; b=zN41zh1WaHqk/xMljp86MDR45CP82Qvi9zr8Ef3ss0YnNpkFinqKHXVfVf0fZneN1i gOm5GOzPkUQfyvKW7BUj01evQar2XO8vaINxaV4DGrpxeJfELEVb5FRGRgXtSOk1pJfa l/XkVif3h6Yh33xzM5qP6QycboI+8FIAqN9Cali7uxaBJKoI/6/6sIJ9tSGwJYLmpWrg 2guwv0H1moCyZxY9DFpa/f+jqU/tyN/25Ll8E8BMwY8w5XmGbIVcQUH/QDWZmwWNNLyW X8pTQGE5SWu9AG97LBUdV7vlRBbeJZTck7qEcr2qeQ9/QzGqli2A0RWyqJhtnE9IFwSZ 8tMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=bLdwmKEAJyfCTIw2vpG3n5RthjBWmKYNxDzcqZCBTE4=; b=mb5OtKUjO9PaxNKFm+S0qVJuL1qHQN9/7hcANeY3IN1zuq+WGFDqrACnwNFY5+w07R U2NLkNAVsYN6yaP7mxvbMx79NBgLP8SZHweyji7aGlULN30m2l9rMG35Bpd/BFfeDh6E vk8haMc3Fs64AI2YYETqVuxNen+8mC8m8+a+DA9RST1cT/sr109PQ3Cfpy6jkuH2M5Ci U4rROSNE95IRlU0vM8I15d2NooKOZCAfDiX66vNxd0rr0DGX8ZqoUlFzX1/H6ZuXz/Rb +KyTE5A54SJZotJoI07+uxHBAI8Rz17FZgOGEB/xoL4jY06Qs/UNKF5rCOyEJ4fjE/2x AhAg== ARC-Authentication-Results: i=1; mx.google.com; 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 z11si9409300pgz.412.2018.04.07.20.26.04; Sat, 07 Apr 2018 20:26:41 -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; 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 S1752822AbeDHDUO (ORCPT + 99 others); Sat, 7 Apr 2018 23:20:14 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:57350 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752034AbeDHDUK (ORCPT ); Sat, 7 Apr 2018 23:20:10 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1f50sB-0006It-Ab; Sun, 08 Apr 2018 11:20:07 +0800 Received: from herbert by gondobar with local (Exim 4.84_2) (envelope-from ) id 1f50rf-0006aQ-Rb; Sun, 08 Apr 2018 11:19:35 +0800 Date: Sun, 8 Apr 2018 11:19:35 +0800 From: Herbert Xu To: Salvatore Mesoraca Cc: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-crypto@vger.kernel.org, "David S. Miller" , Kees Cook , Eric Biggers , Laura Abbott Subject: Re: [PATCH 2/6] crypto: ctr - avoid VLA use Message-ID: <20180408031935.GC25197@gondor.apana.org.au> References: <1523126303-23205-1-git-send-email-s.mesoraca16@gmail.com> <1523126303-23205-3-git-send-email-s.mesoraca16@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1523126303-23205-3-git-send-email-s.mesoraca16@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 07, 2018 at 08:38:19PM +0200, Salvatore Mesoraca wrote: > > @@ -206,6 +207,14 @@ static struct crypto_instance *crypto_ctr_alloc(struct rtattr **tb) > if (alg->cra_blocksize < 4) > goto out_put_alg; > > + /* Block size must be <= MAX_BLOCKSIZE. */ > + if (alg->cra_blocksize > MAX_BLOCKSIZE) > + goto out_put_alg; > + > + /* Alignmask must be <= MAX_ALIGNMASK. */ > + if (alg->cra_alignmask > MAX_ALIGNMASK) > + goto out_put_alg; > + Since you're also adding a check to cipher algorithms in general, none of these individual checks are needed anymore. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt