diff options
-rw-r--r-- | contrib/ntp/ntpd/ntp_control.c | 2 | ||||
-rw-r--r-- | include/Makefile | 25 | ||||
-rw-r--r-- | lib/libc/stdlib/Makefile.inc | 5 | ||||
-rw-r--r-- | lib/libc/stdlib/Symbol.map | 1 | ||||
-rw-r--r-- | lib/libc/stdlib/reallocarray.3 | 142 | ||||
-rw-r--r-- | lib/libc/stdlib/reallocarray.c | 42 | ||||
-rw-r--r-- | release/Makefile | 1 | ||||
-rw-r--r-- | release/Makefile.arm | 134 | ||||
-rw-r--r-- | release/arm/Makefile.BEAGLEBONE | 10 | ||||
-rw-r--r-- | release/arm/Makefile.PANDABOARD | 9 | ||||
-rw-r--r-- | release/arm/Makefile.RPI-B | 10 | ||||
-rw-r--r-- | release/arm/Makefile.WANDBOARD-QUAD | 10 | ||||
-rw-r--r-- | release/arm/Makefile.ZEDBOARD | 9 | ||||
-rw-r--r-- | release/arm/ROADMAP | 18 | ||||
-rwxr-xr-x | release/release.sh | 2 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 2 | ||||
-rw-r--r-- | sys/netinet/sctp_auth.c | 4 |
17 files changed, 223 insertions, 203 deletions
diff --git a/contrib/ntp/ntpd/ntp_control.c b/contrib/ntp/ntpd/ntp_control.c index 2a1cf22f3007..91ab39a83363 100644 --- a/contrib/ntp/ntpd/ntp_control.c +++ b/contrib/ntp/ntpd/ntp_control.c @@ -4,7 +4,7 @@ */ /* - * $FreeBSD: head/contrib/ntp/ntpd/ntp_control.c 276071 2014-12-22 18:54:55Z delphij $ + * $FreeBSD: projects/release-arm-redux/contrib/ntp/ntpd/ntp_control.c 276071 2014-12-22 18:54:55Z delphij $ */ #ifdef HAVE_CONFIG_H diff --git a/include/Makefile b/include/Makefile index d7badd7489b1..fe29186bfccd 100644 --- a/include/Makefile +++ b/include/Makefile @@ -57,16 +57,20 @@ LSUBDIRS= cam/ata cam/scsi \ security/mac_mls security/mac_partition \ ufs/ffs ufs/ufs -LSUBSUBDIRS= dev/mpt/mpilib - -.if ${MK_BLUETOOTH} != "no" -LSUBSUBDIRS+= netgraph/bluetooth/include +.if ${MK_USB} != "no" +LSUBDIRS+= dev/usb .endif +LSUBSUBDIRS= dev/mpt/mpilib + .if ${MK_CUSE} != "no" LSUBDIRS+= fs/cuse .endif +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" +_dev_powermac_nvram= dev/powermac_nvram +.endif + .if ${MK_GSSAPI} != "no" SUBDIR+= gssapi INCS+= gssapi.h @@ -76,18 +80,15 @@ INCS+= gssapi.h INCS+= hesiod.h .endif +.if ${MK_BLUETOOTH} != "no" +LSUBSUBDIRS+= netgraph/bluetooth/include +.endif + # Handle the #define aliases for libiconv .if ${MK_ICONV} == "yes" INCS+= iconv.h .endif - -.if ${MK_USB} != "no" -LSUBDIRS+= dev/usb -.endif - -.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" -_dev_powermac_nvram= dev/powermac_nvram -.endif + # Define SHARED to indicate whether you want symbolic links to the system # source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc index 7cee03af8df8..57205a756a97 100644 --- a/lib/libc/stdlib/Makefile.inc +++ b/lib/libc/stdlib/Makefile.inc @@ -10,8 +10,7 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \ merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c quick_exit.c \ radixsort.c rand.c \ - random.c reallocarray.c reallocf.c realpath.c remque.c strfmon.c \ - strtoimax.c \ + random.c reallocf.c realpath.c remque.c strfmon.c strtoimax.c \ strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c @@ -26,7 +25,7 @@ MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 \ hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \ lsearch.3 memory.3 ptsname.3 qsort.3 \ quick_exit.3 \ - radixsort.3 rand.3 random.3 reallocarray.3 reallocf.3 \ + radixsort.3 rand.3 random.3 reallocf.3 \ realpath.3 strfmon.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 \ tsearch.3 diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map index 782023e022ee..39eab7da43c2 100644 --- a/lib/libc/stdlib/Symbol.map +++ b/lib/libc/stdlib/Symbol.map @@ -113,7 +113,6 @@ FBSD_1.4 { hcreate_r; hdestroy_r; hsearch_r; - reallocarray; }; FBSDprivate_1.0 { diff --git a/lib/libc/stdlib/reallocarray.3 b/lib/libc/stdlib/reallocarray.3 deleted file mode 100644 index 8e714f4daecc..000000000000 --- a/lib/libc/stdlib/reallocarray.3 +++ /dev/null @@ -1,142 +0,0 @@ -.\" Copyright (c) 1980, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" the American National Standards Committee X3, on Information -.\" Processing Systems. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd May 1, 2015 -.Dt REALLOCARRAY 3 -.Os -.Sh NAME -.Nm reallocarray -.Nd memory reallocation function -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In stdlib.h -.Ft void * -.Fn reallocarray "void *ptr" "size_t nmemb" "size_t size" -.Sh DESCRIPTION -The -.Fn reallocarray -function is similar to the -.Fn realloc -function -except it operates on -.Fa nmemb -members of size -.Fa size -and checks for integer overflow in the calculation -.Fa nmemb -* -.Fa size . -.Sh RETURN VALUES -The -.Fn reallocarray -function returns a pointer to the allocated space; otherwise, a -.Dv NULL -pointer is returned and -.Va errno -is set to -.Er ENOMEM . -.Sh EXAMPLES -Consider -.Fn reallocarray -when there is multiplication in the -.Fa size -argument of -.Fn malloc -or -.Fn realloc . -For example, avoid this common idiom as it may lead to integer overflow: -.Bd -literal -offset indent -if ((p = malloc(num * size)) == NULL) - err(1, "malloc"); -.Ed -.Pp -A drop-in replacement is the -.Ox -extension -.Fn reallocarray : -.Bd -literal -offset indent -if ((p = reallocarray(NULL, num, size)) == NULL) - err(1, "reallocarray"); -.Ed -.Pp -When using -.Fn realloc , -be careful to avoid the following idiom: -.Bd -literal -offset indent -size += 50; -if ((p = realloc(p, size)) == NULL) - return (NULL); -.Ed -.Pp -Do not adjust the variable describing how much memory has been allocated -until the allocation has been successful. -This can cause aberrant program behavior if the incorrect size value is used. -In most cases, the above sample will also result in a leak of memory. -As stated earlier, a return value of -.Dv NULL -indicates that the old object still remains allocated. -Better code looks like this: -.Bd -literal -offset indent -newsize = size + 50; -if ((newp = realloc(p, newsize)) == NULL) { - free(p); - p = NULL; - size = 0; - return (NULL); -} -p = newp; -size = newsize; -.Ed -.Pp -As with -.Fn malloc , -it is important to ensure the new size value will not overflow; -i.e. avoid allocations like the following: -.Bd -literal -offset indent -if ((newp = realloc(p, num * size)) == NULL) { - ... -.Ed -.Pp -Instead, use -.Fn reallocarray : -.Bd -literal -offset indent -if ((newp = reallocarray(p, num, size)) == NULL) { - ... -.Ed -.Sh SEE ALSO -.Xr realloc 3 -.Sh HISTORY -The -.Fn reallocarray -function first appeared in -.Ox 5.6 -and -.Fx 11.0 . diff --git a/lib/libc/stdlib/reallocarray.c b/lib/libc/stdlib/reallocarray.c deleted file mode 100644 index e1e9b7c16fff..000000000000 --- a/lib/libc/stdlib/reallocarray.c +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */ -/* - * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <errno.h> -#include <stdint.h> -#include <stdlib.h> - -/* - * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX - * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW - */ -#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) - -void * -reallocarray(void *optr, size_t nmemb, size_t size) -{ - - if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && - nmemb > 0 && SIZE_MAX / nmemb < size) { - errno = ENOMEM; - return (NULL); - } - return (realloc(optr, size * nmemb)); -} diff --git a/release/Makefile b/release/Makefile index e3485f222ad5..7b599409e51c 100644 --- a/release/Makefile +++ b/release/Makefile @@ -303,3 +303,4 @@ release-install: cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5 .include "${.CURDIR}/Makefile.vm" +.include "${.CURDIR}/Makefile.arm" diff --git a/release/Makefile.arm b/release/Makefile.arm new file mode 100644 index 000000000000..b7092c32bbc1 --- /dev/null +++ b/release/Makefile.arm @@ -0,0 +1,134 @@ +# +# $FreeBSD$ +# + +BOARDS?= BEAGLEBONE \ + RPI-B \ + PANDABOARD \ + WANDBOARD-QUAD \ + ZEDBOARD + +ARMTARGETS?= +ARMSIZE?= 1G +BOOTSIZE?= 4m +ARM_WFLAGS?= CROSS_TOOLCHAIN=armv6-gcc +ARMPORTS?= + +WITH_ARM_IMAGES?=1 +CLEANFILES+= arm-all + +.if defined(WITH_ARM_IMAGES) && !empty(WITH_ARM_IMAGES) && !empty(BOARDS) +. for BOARD in ${BOARDS} +ARMTARGETS+= arm-${BOARD:tl} +ARMBEFORECLEAN+= arm-mdclean${BOARD:tl} +CLEANDIRS+= arm-${BOARD:tl} \ + arm-${BOARD:tl}-boot +CLEANFILES+= arm-buildworld${BOARD:tl} \ + arm-buildkernel${BOARD:tl} \ + arm-installworld${BOARD:tl} \ + arm-installkernel${BOARD:tl} \ + ${${BOARD:tu}IMAGE} \ + ${${BOARD:tu}MDDEV} \ + ${${BOARD:tu}MDFILE} \ + ${${BOARD:tu}BOOTDEV} \ + ${${BOARD:tu}BOOTFILE} \ + build-arm-${BOARD:tl} \ + build-arm-ports${BOARD:tl} +${BOARD:tu}IMAGE= arm-${BOARD:tu}.img +${BOARD:tu}MDDEV= arm-${BOARD:tu}.mddev +${BOARD:tu}MDFILE= arm-${BOARD:tu}.raw +${BOARD:tu}BOOTDEV= arm-${BOARD:tu}.bootdev +${BOARD:tu}BOOTFILE= arm-${BOARD:tu}.boot +. if exists(${.CURDIR}/arm/Makefile.${BOARD}) +. include "${.CURDIR}/arm/Makefile.${BOARD}" +. endif + +arm-mdclean${BOARD:tl}: +.if exists(${${BOARD:tu}MDDEV}) + umount ${${BOARD:tu}MDFILE} || true + mdconfig -d -u $$(cat ${${BOARD:tu}MDDEV}) +.endif +.if exists(${${BOARD:tu}BOOTDEV}) + umount ${${BOARD:tu}BOOTFILE} || true + mdconfig -d -u $$(cat ${${BOARD:tu}BOOTDEV}) +.endif + +arm-${BOARD:tl}: arm-buildworld${BOARD:tl} arm-buildkernel${BOARD:tl} \ + arm-installworld${BOARD:tl} arm-installkernel${BOARD:tl} + ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} build-${.TARGET} + +arm-buildworld${BOARD:tl}: + @echo ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${ARM_WFLAGS} \ + buildworld + touch ${.TARGET} + +arm-buildkernel${BOARD:tl}: + @echo ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${ARM_WFLAGS} \ + KERNCONF=${BOARD} buildkernel + touch ${.TARGET} + +arm-installworld${BOARD:tl}: arm-mkfs${BOARD:tl} + @echo ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${ARM_WFLAGS} \ + DESTDIR=${.OBJDIR}/arm-${BOARD:tl} installworld distribution + touch ${.TARGET} + +arm-installkernel${BOARD:tl}: + @echo ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${ARM_WFLAGS} \ + DESTDIR=${.OBJDIR}/arm-${BOARD:tl} KERNCONF=${BOARD} \ + installkernel + touch ${.TARGET} + +arm-mkfs${BOARD:tl}: +.if !exists(${${BOARD:tu}MDDEV}) + mkdir -p ${.OBJDIR}/arm-${BOARD:tl} + truncate -s ${ARMSIZE} ${.OBJDIR}/${${BOARD:tu}MDFILE} + echo $$(mdconfig -f ${.OBJDIR}/${${BOARD:tu}MDFILE}) > \ + ${.OBJDIR}/${${BOARD:tu}MDDEV} + newfs -S 4096 /dev/$$(cat ${.OBJDIR}/${${BOARD:tu}MDDEV}) + mount /dev/$$(cat ${.OBJDIR}/${${BOARD:tu}MDDEV}) \ + ${.OBJDIR}/arm-${BOARD:tl} +.endif +.if !exists(${${BOARD:tu}BOOTDEV}) + mkdir -p ${.OBJDIR}/arm-${BOARD:tl}-boot + truncate -s ${BOOTSIZE} ${.OBJDIR}/${${BOARD:tu}BOOTFILE} + echo $$(mdconfig -f ${.OBJDIR}/${${BOARD:tu}BOOTFILE}) > \ + ${.OBJDIR}/${${BOARD:tu}BOOTDEV} + newfs_msdos -S 4096 /dev/$$(cat ${.OBJDIR}/${${BOARD:tu}BOOTDEV}) + mount_msdosfs /dev/$$(cat ${.OBJDIR}/${${BOARD:tu}BOOTDEV}) \ + ${.OBJDIR}/arm-${BOARD:tl}-boot +.endif + +arm-mkimage${BOARD:tl}: +.if exists(/dev/$$(cat ${.OBJDIR}/${${BOARD:tu}BOOTDEV}) + umount ${.OBJDIR}/arm-${BOARD:tl}-boot +.endif +.if exists(/dev/$$(cat ${.OBJDIR}/${${BOARD:tu}MDDEV}) + umount ${.OBJDIR}/arm-${BOARD:tl} +.endif +# FIXME: +# Do these things need to be MBR? +# I'm also not entirely sure this is correct, anyway. +# + mkimg -s ${${BOARD}PARTSCHEME} \ + -b ${${BOARD:tu}BOOTFILE} \ + -p freebsd/rootfs:=${${BOARD:tu}MDFILE} \ + -o ${${BOARD:tu}IMAGE} + +build-arm-ports${BOARD:tl}: +. if defined(ARMPORTS) && !empty(ARMPORTS) +. if !exists(${PORTSDIR}/Makefile) +. error "Ports tree (${PORTSDIR}) is required." +. endif +. for AP in ${ARMPORTS} + @echo ${MAKE} -C ${PORTSDIR}/${AP} all install clean distclean +. endfor +. endif + touch ${.TARGET} + +. endfor # main loop +.endif # !WITH_ARM_IMAGES + +beforeclean: ${ARMBEFORECLEAN} + +arm-all: ${ARMTARGETS} + touch ${.TARGET} diff --git a/release/arm/Makefile.BEAGLEBONE b/release/arm/Makefile.BEAGLEBONE new file mode 100644 index 000000000000..5f59f0317d88 --- /dev/null +++ b/release/arm/Makefile.BEAGLEBONE @@ -0,0 +1,10 @@ +# +# $FreeBSD$ +# + +BOARD= BEAGLEBONE +${BOARD}PARTSCHEME= mbr +ARMPORTS= sysutils/u-boot-beaglebone + +build-arm-${BOARD:tl}: build-arm-ports${BOARD:tl} + touch ${.TARGET} diff --git a/release/arm/Makefile.PANDABOARD b/release/arm/Makefile.PANDABOARD new file mode 100644 index 000000000000..cd911e9cbb62 --- /dev/null +++ b/release/arm/Makefile.PANDABOARD @@ -0,0 +1,9 @@ +# +# $FreeBSD$ +# + +BOARD= PANDABOARD +${BOARD}PARTSCHEME= mbr + +build-arm-${BOARD:tl}: + touch ${.TARGET} diff --git a/release/arm/Makefile.RPI-B b/release/arm/Makefile.RPI-B new file mode 100644 index 000000000000..c81e51ed35c6 --- /dev/null +++ b/release/arm/Makefile.RPI-B @@ -0,0 +1,10 @@ +# +# $FreeBSD$ +# + +BOARD= RPI-B +${BOARD}PARTSCHEME= mbr +ARMPORTS= sysutils/u-boot-rpi + +build-arm-${BOARD:tl}: build-arm-ports${BOARD:tl} + touch ${.TARGET} diff --git a/release/arm/Makefile.WANDBOARD-QUAD b/release/arm/Makefile.WANDBOARD-QUAD new file mode 100644 index 000000000000..d7f7ff7e4474 --- /dev/null +++ b/release/arm/Makefile.WANDBOARD-QUAD @@ -0,0 +1,10 @@ +# +# $FreeBSD$ +# + +BOARD= WANDBOARD-QUAD +${BOARD}PARTSCHEME= mbr +ARMPORTS= sysutils/u-boot-wandboard + +build-arm-${BOARD:tl}: build-arm-ports${BOARD:tl} + touch ${.TARGET} diff --git a/release/arm/Makefile.ZEDBOARD b/release/arm/Makefile.ZEDBOARD new file mode 100644 index 000000000000..5d3a6856cc1d --- /dev/null +++ b/release/arm/Makefile.ZEDBOARD @@ -0,0 +1,9 @@ +# +# $FreeBSD$ +# + +BOARD= ZEDBOARD +${BOARD}PARTSCHEME= mbr + +build-arm-${BOARD:tl}: + touch ${.TARGET} diff --git a/release/arm/ROADMAP b/release/arm/ROADMAP new file mode 100644 index 000000000000..c76a41eb57a9 --- /dev/null +++ b/release/arm/ROADMAP @@ -0,0 +1,18 @@ +# +# $FreeBSD$ +# + +== WORKFLOW +===================================================================== + +- buildworld [1] +- buildkernel [1] +- ports build [2] +- md(4) device creation, mount, installworld, installkernel +- u-boot magic [2] +- rc.conf edits (gpart resize, sshd, etc.) +- ??? +- profit. + +[1]: Requires CROSS_TOOLCHAIN +[2]: If necessary diff --git a/release/release.sh b/release/release.sh index 158794f0c515..a822d783c59d 100755 --- a/release/release.sh +++ b/release/release.sh @@ -39,6 +39,8 @@ PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" export PATH +VERSION=2 + # Prototypes that can be redefined per-chroot or per-target. load_chroot_env() { } load_target_env() { } diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 154c250b4b91..1d5ba1a96f1a 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -3371,6 +3371,8 @@ coredump(struct thread *td) len = MAXPATHLEN * 2 + sizeof(comm_name) - 1 + sizeof(' ') + sizeof(core_name) - 1; data = malloc(len, M_TEMP, M_WAITOK); + if (data == NULL) + goto out; if (vn_fullpath_global(td, p->p_textvp, &fullpath, &freepath) != 0) goto out; if (!coredump_sanitise_path(fullpath)) diff --git a/sys/netinet/sctp_auth.c b/sys/netinet/sctp_auth.c index 7c2e194e1d2f..8ce2aab4f936 100644 --- a/sys/netinet/sctp_auth.c +++ b/sys/netinet/sctp_auth.c @@ -576,12 +576,13 @@ sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked /* decrement the ref count */ if (skey) { + sctp_free_sharedkey(skey); SCTPDBG(SCTP_DEBUG_AUTH2, "%s: stcb %p key %u refcount release to %d\n", __FUNCTION__, (void *)stcb, key_id, skey->refcount); /* see if a notification should be generated */ - if ((skey->refcount <= 2) && (skey->deactivated)) { + if ((skey->refcount <= 1) && (skey->deactivated)) { /* notify ULP that key is no longer used */ sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, key_id, 0, so_locked); @@ -589,7 +590,6 @@ sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked "%s: stcb %p key %u no longer used, %d\n", __FUNCTION__, (void *)stcb, key_id, skey->refcount); } - sctp_free_sharedkey(skey); } } |