Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FF7243C06A for ; Wed, 15 Jul 2026 10:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784110742; cv=none; b=f/6hVOb1QEKAFBNnTVEGjYFugcGiXfjQcdayp8yKm5TjW1XM2olbumrK38eVM1+H3EnIwEf2ZKv0qB86oLaD9UjA3tdjiFy/5KJV2igiImtMs6/tmxon1cbEDj+V/r2vENruNeEa1ofQ772ag1CYgNLhMhu/4iX+lRAUFeNo66I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784110742; c=relaxed/simple; bh=ystJpXvlHMTfT7lRe96a595ciHhLiR21PTuPBLogGk0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=WOQ9QKsXx29EuF3+z2t2DthnYD5STlMhGbqh8bPpGJWnJ9uoXbPP7y90QE1Q5VCMrlGWuyf5gyJ2CQEcY4tx8rRbyCmH392jUtu8YU7AqqnYBY8zdTbuAO5KEdRnOtUmlD7TvVwROoZecYIuxWgmQ/lMdC5CNAmAKSvRvDIK9jg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=V6eD6Yn6; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="V6eD6Yn6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1191A1F000E9; Wed, 15 Jul 2026 10:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784110741; bh=aG50FZH8j/m3J8APHruDgnCaNG/9OtT8YXHYAloFrtY=; h=Subject:To:Cc:From:Date; b=V6eD6Yn6jJOTC5ebsOeiA0X5U3RvnQsHr4ElCVDX4GU/S2L0ARNC6vrGvg+S+NiKz Ul0C860zmmgJKeQfgBf/wE/MB6vd1HXEepvlpjkxTWGuKzIkxAUSB8uEZRy7++4e7O RQN1lbLacbIEc6nibe2I7ZxeeU+32aQZPjIfEgXw= Subject: FAILED: patch "[PATCH] crypto: drbg - Fix ineffective sanity check" failed to apply to 5.15-stable tree To: ebiggers@kernel.org,herbert@gondor.apana.org.au Cc: From: Date: Wed, 15 Jul 2026 12:18:33 +0200 Message-ID: <2026071533-resale-esophagus-0ce0@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 040ad83b0e8aa065fd2fc641cacba8491a8b186d # git commit -s git send-email --to '' --in-reply-to '2026071533-resale-esophagus-0ce0@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 040ad83b0e8aa065fd2fc641cacba8491a8b186d Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 19 Apr 2026 23:33:47 -0700 Subject: [PATCH] crypto: drbg - Fix ineffective sanity check Fix drbg_healthcheck_sanity() to correctly check the return value of drbg_generate(). drbg_generate() returns 0 on success, or a negative errno value on failure. drbg_healthcheck_sanity() incorrectly assumed that it returned a positive value on success. This didn't make the sanity check fail, but it made it ineffective. Fixes: cde001e4c3c3 ("crypto: rng - RNGs must return 0 in success case") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu diff --git a/crypto/drbg.c b/crypto/drbg.c index de4c69032155..f23b431bd490 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1737,7 +1737,6 @@ static int drbg_kcapi_seed(struct crypto_rng *tfm, */ static inline int __init drbg_healthcheck_sanity(void) { - int len = 0; #define OUTBUFLEN 16 unsigned char buf[OUTBUFLEN]; struct drbg_state *drbg = NULL; @@ -1782,11 +1781,11 @@ static inline int __init drbg_healthcheck_sanity(void) max_request_bytes = drbg_max_request_bytes(drbg); drbg_string_fill(&addtl, buf, max_addtllen + 1); /* overflow addtllen with additional info string */ - len = drbg_generate(drbg, buf, OUTBUFLEN, &addtl); - BUG_ON(0 < len); + ret = drbg_generate(drbg, buf, OUTBUFLEN, &addtl); + BUG_ON(ret == 0); /* overflow max_bits */ - len = drbg_generate(drbg, buf, (max_request_bytes + 1), NULL); - BUG_ON(0 < len); + ret = drbg_generate(drbg, buf, max_request_bytes + 1, NULL); + BUG_ON(ret == 0); /* overflow max addtllen with personalization string */ ret = drbg_seed(drbg, &addtl, false);