Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp214258pxu; Thu, 7 Jan 2021 03:00:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJy2BqFFoo+bZ4tCsUpfPuu9/fpyArmn7Fr309LN0LfxePHuR3DoAOPDDv7nvl0qIjyU7KuS X-Received: by 2002:a05:6402:14c5:: with SMTP id f5mr1244284edx.232.1610017249697; Thu, 07 Jan 2021 03:00:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610017249; cv=none; d=google.com; s=arc-20160816; b=FT4enWglk6qdBiVfUfzR9lKk444WVa5nWrUIZsRuhxo8ZfD6O/nS3MOSbDwlncAPGa Se6AprgyhAAUbJ9h32qCL8cYHMbGyxj7eSDCW3v9NRQz7aE4SOVUyEp+q58qK/wIdLol dJfNZP/xbrkl+LFR/j3yAUHdp6gVRxU/oxdKyRHvv17A6BuZgt6WWSAfyIEI84oQeEqB bGyI5f0IfEJSx0GR+EK5YdEStOoTyZLPC6582KLuNZYaI+jAVY9XWUmg6xfapgxypSH7 I4sg3FUh12FG7us5PrA+dvq82JTEDWD/hsh2y0iN5i/tMr8cV5gJ+54rr2gYfEyHsLph Mp/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=eJuYKsFgeD/TaN1guAoXSRGGao5WVLChcuMpd8zsQq4=; b=ck/E3VIf0M0IqpRWBoG7iSwOHJk4J38Nm/WPuM9jCfVTO0hqXLC2ouHSQmEjuhW68v eIgdSxtyGCFljq9outYlC4vidyjsreNfL1IFGw0Ej+kS7kKewLqt3GEJzubjc9jM0EqR L1IHkV5g5rtCszYpyI6Psl7bh+nF5M3r1rS3wpfdlwnrjfnrQSC6S/GKM9/VulYIz+3p mEIeo45FJM7cm8RyNA5sBtmlKRCYJSDYXdFJhJ950cyRbSYSsTRdQC+qv5DwtT/w6iks 6axMILUbNakbO2OCxdVQCCpNDGdSQnOfIF6A2Uf6kfacMEunFaeCMQr/Shrv5Wpsaztz Cqng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=huqjN0Ws; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si2022454ejf.641.2021.01.07.03.00.28; Thu, 07 Jan 2021 03:00:49 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=huqjN0Ws; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726541AbhAGK7k (ORCPT + 99 others); Thu, 7 Jan 2021 05:59:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35637 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726362AbhAGK7j (ORCPT ); Thu, 7 Jan 2021 05:59:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610017093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eJuYKsFgeD/TaN1guAoXSRGGao5WVLChcuMpd8zsQq4=; b=huqjN0WsnF0kqGM5w+LF+0bg3LYzVV1br55vwxpc2u16wGPxOlDt669Kxz52uwwLVcG/25 N6PbCNH17/x8Mszg1U7Blx8JkvD+fMiJ99JHqMnIwphcw0p1Iw4raIXcmUC12lfNPcoGBP kB6cjTaQYmjIK5UC5qwq9+H3/vMNiA4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-378-PLDymmrbNOGnq5zJt0MzTg-1; Thu, 07 Jan 2021 05:58:09 -0500 X-MC-Unique: PLDymmrbNOGnq5zJt0MzTg-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47B8F4239C; Thu, 7 Jan 2021 10:58:06 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-8.rdu2.redhat.com [10.10.112.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67BC271CB9; Thu, 7 Jan 2021 10:58:03 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20210107092855.76093-1-tianjia.zhang@linux.alibaba.com> References: <20210107092855.76093-1-tianjia.zhang@linux.alibaba.com> To: Tianjia Zhang Cc: dhowells@redhat.com, Herbert Xu , "David S. Miller" , Gilad Ben-Yossef , Tobias Markus , Tee Hao Wei , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] X.509: Fix crash caused by NULL pointer MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <772252.1610017082.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Thu, 07 Jan 2021 10:58:02 +0000 Message-ID: <772253.1610017082@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Tianjia Zhang wrote: > On the following call path, `sig->pkey_algo` is not assigned > in asymmetric_key_verify_signature(), which causes runtime > crash in public_key_verify_signature(). > = > keyctl_pkey_verify > asymmetric_key_verify_signature > verify_signature > public_key_verify_signature > = > This patch simply check this situation and fixes the crash > caused by NULL pointer. > = > Fixes: 215525639631 ("X.509: support OSCCA SM2-with-SM3 certificate veri= fication") > Cc: stable@vger.kernel.org # v5.10+ > Reported-by: Tobias Markus > Signed-off-by: Tianjia Zhang Looks reasonable: Acked-by: David Howells I wonder, though, if cert_sig_digest_update() should be obtained by some s= ort of function pointer. It doesn't really seem to belong in this file. But = this is a separate issue. David