Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Don't allow sav->lft_c to be NULL



details:   https://anonhg.NetBSD.org/src/rev/ac443d876d22
branches:  trunk
changeset: 825859:ac443d876d22
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Aug 03 03:12:02 2017 +0000

description:
Don't allow sav->lft_c to be NULL

lft_c of an sav that was created by SADB_GETSPI could be NULL.

diffstat:

 sys/netipsec/key.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 3af4fa48774c -r ac443d876d22 sys/netipsec/key.c
--- a/sys/netipsec/key.c        Thu Aug 03 00:05:56 2017 +0000
+++ b/sys/netipsec/key.c        Thu Aug 03 03:12:02 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: key.c,v 1.200 2017/08/02 03:45:57 ozaki-r Exp $        */
+/*     $NetBSD: key.c,v 1.201 2017/08/03 03:12:02 ozaki-r Exp $        */
 /*     $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $        */
 /*     $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $   */
 
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.200 2017/08/02 03:45:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.201 2017/08/03 03:12:02 ozaki-r Exp $");
 
 /*
  * This code is referd to RFC 2367
@@ -2968,6 +2968,10 @@
                *errp = key_setsaval(newsav, m, mhp);
                if (*errp)
                        goto error;
+       } else {
+               /* We don't allow lft_c to be NULL */
+               newsav->lft_c = kmem_zalloc(sizeof(struct sadb_lifetime),
+                   KM_SLEEP);
        }
 
        /* reset created */



Home | Main Index | Thread Index | Old Index