Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6142946iog; Thu, 23 Jun 2022 12:14:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t/FqNCtAtXbW44GKN8LvBNuD+WSuoSIn1tQZTXX32Ja2qLAuwEIkHC9y+FD5bq0PPWEIqD X-Received: by 2002:a63:7412:0:b0:40c:fa27:9d07 with SMTP id p18-20020a637412000000b0040cfa279d07mr8835999pgc.27.1656011652880; Thu, 23 Jun 2022 12:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011652; cv=none; d=google.com; s=arc-20160816; b=DHHg1M8Vc4F9XQn9YedT26uPMyu0K26CDmTorb/OW8WzAF7LXNxv7+3v+JC/XztFFB fUXJRfX9pJ1EoIBcdXIUk8NK6DhrH0L1FAaInJwB+aQsgtTmA5VOMYpGAVZTw4ky+WsA aDVAfJ87z2TvKgJoFdHfZiRtq2dB82UApFzsWxBrHoYlTeQnh9uMw6h0zhQ1tEabCYlb 3GbhnA9D6GkTDE754IgT48ngnfgD+Y6BT4Rhz01ru6viwuC2FHD/wKrJhsA43rU9K2Bc A3xzVx++e+sqoBvOK7LHoH+Fj4Xm5OqK+CKf1Hy7LGHbBBxJrfbDclbypzY6trP9qdTP c8Aw== 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=MDl0PO6lFMFLodpT/iF3GT0qKOVG5k8GsYbNDaa+sAY=; b=GJu5TkF5DdCS3SU1aHtatGdlayS+LiJbg4+9+QisW8aooUNQUt/j44FMStPOHLAuJz GYIe5DlBctQEt/H5bRaFCx9+yanCitBm6jjVe1NAX38do0Es5eKVzep3m8Hg/xX+fZoP IYLxHl7dpY1Qdi1rTZzbfDilWOdHBWWNaaaLKSLArM72uYco9PaC/j2VE6pGArYKnuWD H+sK3qbGsPV1DAgamDGWBxxJDBrPuVCcPLhrPM0uvCY+LW+o5681IXAwTN9QYO/AB3gX XhzT8QTYOf/N1hXAQO/8U0Blzt5y1FyGYrQCprGyUGlcywygM1I8+E4gxOoXAjws8XKn aBwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sWwYjoTt; 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 d27-20020a634f1b000000b0040d44d5eb03si4766794pgb.630.2022.06.23.12.14.00; Thu, 23 Jun 2022 12:14:12 -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=sWwYjoTt; 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 S236594AbiFWSOK (ORCPT + 99 others); Thu, 23 Jun 2022 14:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236871AbiFWSNH (ORCPT ); Thu, 23 Jun 2022 14:13:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75F34C01E7; Thu, 23 Jun 2022 10:21:07 -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 dfw.source.kernel.org (Postfix) with ESMTPS id A249A6159A; Thu, 23 Jun 2022 17:21:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74397C3411B; Thu, 23 Jun 2022 17:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656004865; bh=A7QUXTe2vcqcJr+MDySXFe5GUol7ZePbQ7rhBPtpvx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sWwYjoTtt5dNE7kdWLAy2BXENN4c6iAgqP1yzEvvgd9A4WfoTfSLsr0BmLfOG2ECH 921B6SqfXxFOmTWXplblbfpRHyaSB92fd86p8NiYiwRAdAKbQftSDpKky79dk3TxeK AezL6tuwr/2dcFs+y3ssE6PuMZTIzg2qtV18aHC4= 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.19 176/234] crypto: drbg - always try to free Jitter RNG instance Date: Thu, 23 Jun 2022 18:44:03 +0200 Message-Id: <20220623164348.031978813@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.042598055@linuxfoundation.org> References: <20220623164343.042598055@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 @@ -1644,10 +1644,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);