Source-Changes-HG archive

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

[src/trunk]: src/sys/netipsec Fix mbuf leaks on error paths



details:   https://anonhg.NetBSD.org/src/rev/3a37485cdd52
branches:  trunk
changeset: 359534:3a37485cdd52
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Feb 14 08:59:23 2018 +0000

description:
Fix mbuf leaks on error paths

Pointed out by maxv@

diffstat:

 sys/netipsec/xform_esp.c    |  5 +++--
 sys/netipsec/xform_ipcomp.c |  5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r daafc9b95be9 -r 3a37485cdd52 sys/netipsec/xform_esp.c
--- a/sys/netipsec/xform_esp.c  Wed Feb 14 06:52:41 2018 +0000
+++ b/sys/netipsec/xform_esp.c  Wed Feb 14 08:59:23 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_esp.c,v 1.73 2018/01/24 13:54:16 maxv Exp $      */
+/*     $NetBSD: xform_esp.c,v 1.74 2018/02/14 08:59:23 ozaki-r Exp $   */
 /*     $FreeBSD: src/sys/netipsec/xform_esp.c,v 1.2.2.1 2003/01/24 05:11:36 sam Exp $  */
 /*     $OpenBSD: ip_esp.c,v 1.69 2001/06/26 06:18:59 angelos Exp $ */
 
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.73 2018/01/24 13:54:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_esp.c,v 1.74 2018/02/14 08:59:23 ozaki-r Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -444,6 +444,7 @@
                pool_cache_put(esp_tdb_crypto_pool_cache, tc);
                crypto_freereq(crp);
                ESP_STATINC(ESP_STAT_NOTDB);
+               m_freem(m);
                return ENOENT;
        }
        KEY_SA_REF(sav);
diff -r daafc9b95be9 -r 3a37485cdd52 sys/netipsec/xform_ipcomp.c
--- a/sys/netipsec/xform_ipcomp.c       Wed Feb 14 06:52:41 2018 +0000
+++ b/sys/netipsec/xform_ipcomp.c       Wed Feb 14 08:59:23 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xform_ipcomp.c,v 1.53 2017/10/03 08:56:52 ozaki-r Exp $        */
+/*     $NetBSD: xform_ipcomp.c,v 1.54 2018/02/14 08:59:23 ozaki-r Exp $        */
 /*     $FreeBSD: src/sys/netipsec/xform_ipcomp.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $       */
 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
 
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.53 2017/10/03 08:56:52 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xform_ipcomp.c,v 1.54 2018/02/14 08:59:23 ozaki-r Exp $");
 
 /* IP payload compression protocol (IPComp), see RFC 2393 */
 #if defined(_KERNEL_OPT)
@@ -192,6 +192,7 @@
         */
        if (__predict_false(sav->state == SADB_SASTATE_DEAD)) {
                pserialize_read_exit(s);
+               m_freem(m);
                pool_cache_put(ipcomp_tdb_crypto_pool_cache, tc);
                crypto_freereq(crp);
                IPCOMP_STATINC(IPCOMP_STAT_NOTDB);



Home | Main Index | Thread Index | Old Index