Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6053476iog; Thu, 23 Jun 2022 10:20:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tUZJO1n4lmTAPGLiKGRIaVomG9yYJzHXHDmgCN/eDSK4KIU85BCyCnIH5/aOehiOxT88q0 X-Received: by 2002:a05:6402:5008:b0:42d:c421:48c8 with SMTP id p8-20020a056402500800b0042dc42148c8mr12029622eda.422.1656004814887; Thu, 23 Jun 2022 10:20:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656004814; cv=none; d=google.com; s=arc-20160816; b=efpLVp0Nodl4h6U3D92yRTTu8B9uCWc787Qs7oUb2bx4iHaAJBdv1z88tplwWhbt2a kofXurln6um1m7ymLoYcb4ut6gPzgl2guhfzozS4nERswoig8YlqPJxiWCqX2X3ViqsG J5r23nsiCdTj0Gpsym4ZOcGMxl5ASusiKYYbrdH5LCA7c8O09jT3AgQ+fT0KeqKpnRuP P7GiSwqXxXbCeJpxH4t5TJDMatmYs58dKtoWgfIJxvMjPXZe4I8TEcnCUEFbzNTq9l5X BiiN7wxryFJDSZ+HHQtcC1NvJ9riTmOgBBub4/8uEU2o1ny1rFCkdHcd5GfSaKni8ekO Bc8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=69xd/4DiX92sO1QtQNoGXoXl1n1evG1cIpF8zak3YV0=; b=hxLZY5YdMJxIC+tvJV89AxpYMvkTw8kQGibNzFHUwxSWZiwaa1uMomEzFs5EgwGNcu C6wCYfnC8iSjptpKfdt+8mE3gYTd2rtgaGnkrv8ouOGlIu4RraCFfO6+47rAT+CqEs66 tlQm+SLsBXcI1Bh+1qhUm4TgIiPW8MMBpPGwpBQOPIqrgOqdrOLQQ2AwaaWp9HbP+JRU X4wB7xBWFV/fKY+K3sC4yoJdpwU9JlagXyINTddXBKjKRolB25hJvlvAh4QbDcPik/An PxQxhAdXFnvNxTgKl9ha67vwdlAmuK3QmFb4yt/ovVnvjR4if76nJC0N6sWkc6KP6Gbz mwiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SBmJ0Wy6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a170906220700b00722e55c8273si9118059ejs.28.2022.06.23.10.19.48; Thu, 23 Jun 2022 10:20:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SBmJ0Wy6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232676AbiFWRPv (ORCPT + 99 others); Thu, 23 Jun 2022 13:15:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233279AbiFWRMo (ORCPT ); Thu, 23 Jun 2022 13:12:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D432241FBE; Thu, 23 Jun 2022 09:58:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86C5AB8248F; Thu, 23 Jun 2022 16:58:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5434C3411B; Thu, 23 Jun 2022 16:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656003506; bh=isyO/DTQYlF73FEx2d7UejnaUEw+tJ7LlnZ7gQHbFIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SBmJ0Wy60MBljBQiMkwaeiIH9yZQ2XcxKx4DKE38raQ68kyoH68ljiR0x+k+W4j7C Z9NZI7dZ780nobH1/NE80Vrv2TExBx+1q+RIXn8zDlZDpuVCqF03TUd58XPelIThJM 9d0Xlao159iwb0yiEdTF/A3RrodPehIBylNIB8n0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+2e635807decef724a1fa@syzkaller.appspotmail.com, Stephan Mueller , Herbert Xu , "Jason A. Donenfeld" Subject: [PATCH 4.9 220/264] crypto: drbg - always try to free Jitter RNG instance Date: Thu, 23 Jun 2022 18:43:33 +0200 Message-Id: <20220623164350.302121396@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Stephan M?ller" commit 819966c06b759022e9932f328284314d9272b9f3 upstream. The Jitter RNG is unconditionally allocated as a seed source follwoing the patch 97f2650e5040. Thus, the instance must always be deallocated. Reported-by: syzbot+2e635807decef724a1fa@syzkaller.appspotmail.com Fixes: 97f2650e5040 ("crypto: drbg - always seeded with SP800-90B ...") Signed-off-by: Stephan Mueller Signed-off-by: Herbert Xu Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- crypto/drbg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1646,10 +1646,12 @@ static int drbg_uninstantiate(struct drb if (drbg->random_ready.notifier_call) { unregister_random_ready_notifier(&drbg->random_ready); cancel_work_sync(&drbg->seed_work); - crypto_free_rng(drbg->jent); - drbg->jent = NULL; } + if (!IS_ERR_OR_NULL(drbg->jent)) + crypto_free_rng(drbg->jent); + drbg->jent = NULL; + if (drbg->d_ops) drbg->d_ops->crypto_fini(drbg); drbg_dealloc_state(drbg);