Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1228832pxf; Fri, 12 Mar 2021 05:14:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqUWwxbGvh/VVwwxcrIq/1SBLDm4F24HtabZadpuU3XrmNqwMB6kgVowfdH6uMjhP3h0u/ X-Received: by 2002:a17:906:2344:: with SMTP id m4mr8300844eja.327.1615554878685; Fri, 12 Mar 2021 05:14:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615554878; cv=none; d=google.com; s=arc-20160816; b=p5TzVqIO2713YbCMyJdzrkoijwjMEwZU9X27wFWo2Kkzf9mlcmJYQKWjDTCQc0EdAc WUBPEqoIK4uDxYF6JrYycU9Nc7I9pNxb6/n3EgGT+Q6Q9/k2u2iw0vN0ifkoG8gWRbPr 88GZRZjkAB/lAGo/ABSqtI0aXTKYmNlhKodt6wDbY57OOeNt8j6YZqZGoz7C65K4GCyL HRCLEW9fdmUDAsb52vLIXJzpwzTQmu6JzfFaPCELfxyBQrO/j9KkezSntJDTn1JsDfpO 9YEpwK2nzBkTQ29rrSEhimq00U0z1sQ6uVvGe+TJGJ2BMTARs8hWdP6tsCRXXNtMR6j5 wmHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=f94DJml8GpVqMX2rbBwpQrz7D41vO2bmcA4RAg6XqMY=; b=vSwwRjiZqdZ6/hNvITxGbRzpSCttcjoJIO5NhLqh7ObsE1XqhBZILgf88tkJKTaeqd eZ8JTGEJoOxq44mywGMfDpp/6yzkT/ZFwdNFUt54HCeqXXiGTzCnU/1CqpVy4TzlzpTw VF9YSlirsR9w7e5MJNZGN57NlQX4oxZSaijyoTnH9lEJHHC4UXBkhDcuE3LO0j2kI3Ln hCj8Lyvok7LeF2fTuE7K/FNQoAFbhSWyXxTUNU+J2GNPhl1glSamQVxVdX04nBlPpyCh q3rYUV2JhOH5MduLr6EZwiFMhq16nBTHV1B74GQ9sd7vLq57JiNsCodNSkWUNzp1ey8E HCbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce13si3964948edb.43.2021.03.12.05.14.13; Fri, 12 Mar 2021 05:14:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231378AbhCLNNO (ORCPT + 99 others); Fri, 12 Mar 2021 08:13:14 -0500 Received: from helcar.hmeau.com ([216.24.177.18]:54496 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbhCLNMn (ORCPT ); Fri, 12 Mar 2021 08:12:43 -0500 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.92 #5 (Debian)) id 1lKham-0006Fj-3e; Sat, 13 Mar 2021 00:12:37 +1100 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Sat, 13 Mar 2021 00:12:36 +1100 Date: Sat, 13 Mar 2021 00:12:36 +1100 From: Herbert Xu To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, syzbot+12cf5fbfdeba210a89dd@syzkaller.appspotmail.com, Eric Biggers Subject: Re: [PATCH v3] crypto: api - check for ERR pointers in crypto_destroy_tfm() Message-ID: <20210312131235.GF31502@gondor.apana.org.au> References: <20210302203303.40881-1-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210302203303.40881-1-ardb@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Mar 02, 2021 at 09:33:03PM +0100, Ard Biesheuvel wrote: > Given that crypto_alloc_tfm() may return ERR pointers, and to avoid > crashes on obscure error paths where such pointers are presented to > crypto_destroy_tfm() (such as [0]), add an ERR_PTR check there > before dereferencing the second argument as a struct crypto_tfm > pointer. > > [0] https://lore.kernel.org/linux-crypto/000000000000de949705bc59e0f6@google.com/ > > Reported-by: syzbot+12cf5fbfdeba210a89dd@syzkaller.appspotmail.com > Reviewed-by: Eric Biggers > Signed-off-by: Ard Biesheuvel > --- > v3: missed crypto_free_shash() in v2 > add Eric's Rb > v2: update kerneldoc comments of callers to crypto_destroy_tfm() that NULL or > error pointers are ignored. > > crypto/api.c | 2 +- > include/crypto/acompress.h | 2 ++ > include/crypto/aead.h | 2 ++ > include/crypto/akcipher.h | 2 ++ > include/crypto/hash.h | 4 ++++ > include/crypto/kpp.h | 2 ++ > include/crypto/rng.h | 2 ++ > include/crypto/skcipher.h | 2 ++ > 8 files changed, 17 insertions(+), 1 deletion(-) Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt