Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Fix nonsensical checks, neither in6p nor reques...



details:   https://anonhg.NetBSD.org/src/rev/e01a0dc73a2e
branches:  trunk
changeset: 359823:e01a0dc73a2e
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Feb 26 06:48:01 2018 +0000

description:
Fix nonsensical checks, neither in6p nor request is allowed to be NULL,
and the former is already dereferenced in a kassert. This code should be
the same as ipsec4_set_policy.

diffstat:

 sys/netipsec/ipsec.c |  9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diffs (32 lines):

diff -r 636d574ef3b5 -r e01a0dc73a2e sys/netipsec/ipsec.c
--- a/sys/netipsec/ipsec.c      Mon Feb 26 06:41:27 2018 +0000
+++ b/sys/netipsec/ipsec.c      Mon Feb 26 06:48:01 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.135 2018/02/26 06:17:01 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.136 2018/02/26 06:48:01 maxv Exp $ */
 /* $FreeBSD: src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.135 2018/02/26 06:17:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.136 2018/02/26 06:48:01 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -1511,11 +1511,10 @@
        struct secpolicy **policy;
 
        KASSERT(!cpu_softintr_p());
+       KASSERT(in6p != NULL);
        KASSERT(in6p_locked(in6p));
+       KASSERT(request != NULL);
 
-       /* sanity check. */
-       if (in6p == NULL || request == NULL)
-               return EINVAL;
        if (len < sizeof(*xpl))
                return EINVAL;
        xpl = (const struct sadb_x_policy *)request;



Home | Main Index | Thread Index | Old Index