Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Fix an untriggerable memory leak. carp_prepare_a...
details: https://anonhg.NetBSD.org/src/rev/d93098c1c110
branches: trunk
changeset: 360654:d93098c1c110
user: maxv <maxv%NetBSD.org@localhost>
date: Wed Mar 21 15:33:25 2018 +0000
description:
Fix an untriggerable memory leak. carp_prepare_ad does not fail, so switch
it to void.
diffstat:
sys/netinet/ip_carp.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diffs (65 lines):
diff -r 12eca76522e7 -r d93098c1c110 sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c Wed Mar 21 14:23:54 2018 +0000
+++ b/sys/netinet/ip_carp.c Wed Mar 21 15:33:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_carp.c,v 1.94 2017/12/06 09:54:47 ozaki-r Exp $ */
+/* $NetBSD: ip_carp.c,v 1.95 2018/03/21 15:33:25 maxv Exp $ */
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
/*
@@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.94 2017/12/06 09:54:47 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.95 2018/03/21 15:33:25 maxv Exp $");
/*
* TODO:
@@ -201,7 +201,7 @@
static void carp_proto_input_c(struct mbuf *, struct carp_header *,
sa_family_t);
static void carpdetach(struct carp_softc *);
-static int carp_prepare_ad(struct mbuf *, struct carp_softc *,
+static void carp_prepare_ad(struct mbuf *, struct carp_softc *,
struct carp_header *);
static void carp_send_ad_all(void);
static void carp_send_ad(void *);
@@ -969,7 +969,7 @@
}
}
-static int
+static void
carp_prepare_ad(struct mbuf *m, struct carp_softc *sc,
struct carp_header *ch)
{
@@ -983,8 +983,6 @@
ch->carp_counter[1] = htonl(sc->sc_counter&0xffffffff);
carp_hmac_generate(sc, ch->carp_counter, ch->carp_md);
-
- return (0);
}
static void
@@ -1110,8 +1108,7 @@
ch_ptr = (struct carp_header *)(&ip[1]);
memcpy(ch_ptr, &ch, sizeof(ch));
- if (carp_prepare_ad(m, sc, ch_ptr))
- goto retry_later;
+ carp_prepare_ad(m, sc, ch_ptr);
m->m_data += sizeof(*ip);
ch_ptr->carp_cksum = carp_cksum(m, len - sizeof(*ip));
@@ -1200,8 +1197,7 @@
ch_ptr = (struct carp_header *)(&ip6[1]);
memcpy(ch_ptr, &ch, sizeof(ch));
- if (carp_prepare_ad(m, sc, ch_ptr))
- goto retry_later;
+ carp_prepare_ad(m, sc, ch_ptr);
ch_ptr->carp_cksum = carp6_cksum(m, sizeof(*ip6),
len - sizeof(*ip6));
Home |
Main Index |
Thread Index |
Old Index