Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci ubsec(4): Assert crp_sid is valid.
details: https://anonhg.NetBSD.org/src/rev/9b5c1a167bfb
branches: trunk
changeset: 366322:9b5c1a167bfb
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun May 22 11:35:05 2022 +0000
description:
ubsec(4): Assert crp_sid is valid.
If opencrypto passes a bad sid in, that's a bug in opencrypto that
needs to be fixed, not a user-triggered invalid input that we need to
fail gracefully on.
diffstat:
sys/dev/pci/ubsec.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diffs (32 lines):
diff -r 92d1032c14f8 -r 9b5c1a167bfb sys/dev/pci/ubsec.c
--- a/sys/dev/pci/ubsec.c Sun May 22 11:34:57 2022 +0000
+++ b/sys/dev/pci/ubsec.c Sun May 22 11:35:05 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ubsec.c,v 1.55 2022/05/22 11:30:58 riastradh Exp $ */
+/* $NetBSD: ubsec.c,v 1.56 2022/05/22 11:35:05 riastradh Exp $ */
/* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
/* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.55 2022/05/22 11:30:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.56 2022/05/22 11:35:05 riastradh Exp $");
#undef UBSEC_DEBUG
@@ -1158,10 +1158,9 @@
u_int16_t flags = 0;
int ivlen = 0, keylen = 0;
- if (UBSEC_SESSION(crp->crp_sid) >= sc->sc_nsessions) {
- ubsecstats.hst_badsession++;
- return (EINVAL);
- }
+ KASSERTMSG(UBSEC_SESSION(crp->crp_sid) < sc->sc_nsessions,
+ "invalid session id 0x%"PRIx64", nsessions=%d",
+ crp->crp_sid, sc->sc_nsessions);
mutex_spin_enter(&sc->sc_mtx);
Home |
Main Index |
Thread Index |
Old Index