Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] lib/digsig: fix some bugs in digsig
@ 2026-12-02 12:20 Dan Carpenter
  2026-12-02 12:20 ` [PATCH 1/3] lib/digsig: Fix error pointer dereference in digsig_verify_rsa() Dan Carpenter
  2026-12-02 20:57 ` [PATCH 0/3] lib/digsig: fix some bugs in digsig Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-12-02 12:20 UTC (permalink / raw)
  To: Andrew Morton, Herbert Xu, Nicolai Stange, Mimi Zohar,
	Dmitry Kasatkin
  Cc: Karthik Bhargavan, Clément Blaudeau, linux-kernel,
	Dan Carpenter, stable

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.

Signed-off-by: Dan Carpenter <dan@pereq.eu>
---
Dan Carpenter (3):
      lib/digsig: Fix error pointer dereference in digsig_verify_rsa()
      lib/digsig: Reject a signature larger than the modulus
      lib/digsig: Reject garbage bytes after the signature

 lib/digsig.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
base-commit: a9c48428cbd8d96b26f92631d0db6f8519c5fcc5
change-id: 20261202-digsig_send-1d579b20c1d2

Best regards,
--  
Dan Carpenter <dan@pereq.eu>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] lib/digsig: Fix error pointer dereference in digsig_verify_rsa()
  2026-12-02 12:20 [PATCH 0/3] lib/digsig: fix some bugs in digsig Dan Carpenter
@ 2026-12-02 12:20 ` Dan Carpenter
  2026-12-02 20:57 ` [PATCH 0/3] lib/digsig: fix some bugs in digsig Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-12-02 12:20 UTC (permalink / raw)
  To: Andrew Morton, Herbert Xu, Nicolai Stange, Mimi Zohar,
	Dmitry Kasatkin
  Cc: Karthik Bhargavan, Clément Blaudeau, linux-kernel,
	Dan Carpenter, stable

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

Fixes: 03cdfaad491e ("lib/mpi: mpi_read_from_buffer(): return error code")
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan@pereq.eu>
---
 lib/digsig.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/digsig.c b/lib/digsig.c
index 9dd319c12c7d..8ca6af0a8fd4 100644
--- a/lib/digsig.c
+++ b/lib/digsig.c
@@ -131,6 +131,7 @@ static int digsig_verify_rsa(struct key *key,
 	in = mpi_read_from_buffer(sig, &nret);
 	if (IS_ERR(in)) {
 		err = PTR_ERR(in);
+		in = NULL;
 		goto err;
 	}
 

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/3] lib/digsig: fix some bugs in digsig
  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-02 20:57 ` Andrew Morton
  2026-12-03  6:18   ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2026-12-02 20:57 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Herbert Xu, Nicolai Stange, Mimi Zohar, Dmitry Kasatkin,
	Karthik Bhargavan, Clément Blaudeau, linux-kernel, stable,
	Dmitry Kasatkin

On Wed, 02 Dec 2026 15:20:27 +0300 Dan Carpenter <dan@pereq.eu> wrote:

> 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.
> 
>  lib/digsig.c | 11 +++++++++++

Thanks.

hp2:/usr/src/mm> scripts/get_maintainer.pl -f lib/digsig.c 
Andrew Morton <akpm@linux-foundation.org> (maintainer:LIBRARY CODE)
linux-kernel@vger.kernel.org (open list:LIBRARY CODE)
LIBRARY CODE status: Supported
hp2:/usr/src/mm> 

Someone please change this!!

Also, Dmitry wrote this in 2011 and may no longer be @intel.com.  Let's
add his gmail.com identity.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/3] lib/digsig: fix some bugs in digsig
  2026-12-02 20:57 ` [PATCH 0/3] lib/digsig: fix some bugs in digsig Andrew Morton
@ 2026-12-03  6:18   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-12-03  6:18 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Herbert Xu, Nicolai Stange, Mimi Zohar, Eric Biggers,
	Karthik Bhargavan, Clément Blaudeau, linux-kernel, stable,
	Dmitry Kasatkin

On Wed, Dec 02, 2026 at 12:57:16PM -0800, Andrew Morton wrote:
> On Wed, 02 Dec 2026 15:20:27 +0300 Dan Carpenter <dan@pereq.eu> wrote:
> 
> > 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.
> > 
> >  lib/digsig.c | 11 +++++++++++
> 
> Thanks.
> 
> hp2:/usr/src/mm> scripts/get_maintainer.pl -f lib/digsig.c 
> Andrew Morton <akpm@linux-foundation.org> (maintainer:LIBRARY CODE)
> linux-kernel@vger.kernel.org (open list:LIBRARY CODE)
> LIBRARY CODE status: Supported
> hp2:/usr/src/mm> 
> 
> Someone please change this!!

Someone needs to summon Greg.  Say his name three times.  :P

Realistically, it's probably going to fall to Mimi or maybe we could put
it under crypto?

regards,
dan carpenter

> 
> Also, Dmitry wrote this in 2011 and may no longer be @intel.com.  Let's
> add his gmail.com identity.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-03  6:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-02 20:57 ` [PATCH 0/3] lib/digsig: fix some bugs in digsig Andrew Morton
2026-12-03  6:18   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox