Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,zohar@us.ibm.com,stable@vger.kernel.org,
	nicstange@gmail.com,karthik@pereq.eu,herbert@gondor.apana.org.au,
	ebiggers@kernel.org,dmitry.kasatkin@gmail.com,clement@cryspen.com,
	dan@pereq.eu,akpm@linux-foundation.org
Subject: + lib-digsig-fix-error-pointer-dereference-in-digsig_verify_rsa.patch added to mm-nonmm-unstable branch
Date: Thu, 03 Dec 2026 11:37:10 -0800	[thread overview]
Message-ID: <20261203193710.8667B1F000CE@smtp.kernel.org> (raw)
In-Reply-To: <20261202-digsig_send-v1-1-2797f094dac3@pereq.eu>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2994 bytes --]


The patch titled
     Subject: lib/digsig: fix error pointer dereference in digsig_verify_rsa()
has been added to the -mm mm-nonmm-unstable branch.  Its filename is
     lib-digsig-fix-error-pointer-dereference-in-digsig_verify_rsa.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/lib-digsig-fix-error-pointer-dereference-in-digsig_verify_rsa.patch

This patch will later appear in the mm-nonmm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days

------------------------------------------------------
From: Dan Carpenter <dan@pereq.eu>
Subject: lib/digsig: fix error pointer dereference in digsig_verify_rsa()
Date: Wed, 02 Dec 2026 15:20:28 +0300

Patch series "lib/digsig: fix some bugs in digsig".

Pereq is doing formal verification work.  These are some bugs we found.

* Dereferencing an error pointer on the error path
* Not implementing the RFC correctly
* Allowing garbage bytes after a signature

Fixing the last two bugs is just about correctness and they don't
actually affect real life.


This patch (of 3):

This error path calls mpi_free() with an error pointer which will
crash.  Set the "in" pointer to a NULL instead.

Link: https://lore.kernel.org/20261202-digsig_send-v1-0-2797f094dac3@pereq.eu
Link: https://patch.msgid.link/20261202-digsig_send-v1-1-2797f094dac3@pereq.eu
Fixes: 03cdfaad491e ("lib/mpi: mpi_read_from_buffer(): return error code")
Signed-off-by: Dan Carpenter <dan@pereq.eu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Eric Biggers <ebiggers@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Nicolai Stange <nicstange@gmail.com>
Cc: Mimi Zohar <zohar@us.ibm.com>
Cc: Karthik Bhargavan <karthik@pereq.eu>
Cc: Clément Blaudeau <clement@cryspen.com>
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
Cc: <stable@vger.kernel.org>

 lib/digsig.c |    1 +
 1 file changed, 1 insertion(+)

--- a/lib/digsig.c~lib-digsig-fix-error-pointer-dereference-in-digsig_verify_rsa
+++ a/lib/digsig.c
@@ -131,6 +131,7 @@ static int digsig_verify_rsa(struct key
 	in = mpi_read_from_buffer(sig, &nret);
 	if (IS_ERR(in)) {
 		err = PTR_ERR(in);
+		in = NULL;
 		goto err;
 	}
 
_

Patches currently in -mm which might be from dan@pereq.eu are

lib-digsig-fix-error-pointer-dereference-in-digsig_verify_rsa.patch
lib-digsig-reject-a-signature-larger-than-the-modulus.patch
lib-digsig-reject-garbage-bytes-after-the-signature.patch


  reply	other threads:[~2026-12-03 19:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 12:20 [PATCH 0/3] lib/digsig: fix some bugs in digsig Dan Carpenter
2026-12-02 12:20 ` [PATCH 1/3] lib/digsig: Fix error pointer dereference in digsig_verify_rsa() Dan Carpenter
2026-12-03 19:37   ` Andrew Morton [this message]
2026-12-02 20:57 ` [PATCH 0/3] lib/digsig: fix some bugs in digsig Andrew Morton
2026-12-03  6:18   ` Dan Carpenter
2026-12-03  6:44     ` Eric Biggers
2026-12-03 12:09       ` Mimi Zohar
2026-12-03 13:49         ` Dmitry Kasatkin
2026-12-03 18:45         ` Eric Biggers
2026-12-03 19:36           ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203193710.8667B1F000CE@smtp.kernel.org \
    --to=akpm@linux-foundation.org \
    --cc=clement@cryspen.com \
    --cc=dan@pereq.eu \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=karthik@pereq.eu \
    --cc=mm-commits@vger.kernel.org \
    --cc=nicstange@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=zohar@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox