Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/opencrypto crypto(4): crypto_freesession should never fa...



details:   https://anonhg.NetBSD.org/src/rev/70f7cdd90be4
branches:  trunk
changeset: 366334:70f7cdd90be4
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun May 22 11:39:17 2022 +0000

description:
crypto(4): crypto_freesession should never fail here.

It can only fail if we pass it an invalid sid, which the logic to
maintain the user sessions should not do.  So kassert error=0 here.

diffstat:

 sys/opencrypto/cryptodev.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r aa67c8c6a35c -r 70f7cdd90be4 sys/opencrypto/cryptodev.c
--- a/sys/opencrypto/cryptodev.c        Sun May 22 11:39:08 2022 +0000
+++ b/sys/opencrypto/cryptodev.c        Sun May 22 11:39:17 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cryptodev.c,v 1.118 2022/05/22 11:34:29 riastradh Exp $ */
+/*     $NetBSD: cryptodev.c,v 1.119 2022/05/22 11:39:17 riastradh Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $        */
 /*     $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $   */
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.118 2022/05/22 11:34:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.119 2022/05/22 11:39:17 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1020,6 +1020,7 @@
        int error;
 
        error = crypto_freesession(cse->sid);
+       KASSERTMSG(error == 0, "error=%d", error);
        if (cse->key)
                free(cse->key, M_XDATA);
        if (cse->mackey)



Home | Main Index | Thread Index | Old Index