Module Name:    src
Committed By:   snj
Date:           Sun Mar 15 22:41:24 UTC 2015

Modified Files:
        src/sys/net/npf [netbsd-7]: npf_conn.c

Log Message:
Pull up following revision(s) (requested by rmind in ticket #586):
        sys/net/npf/npf_conn.c: revision 1.16
npf_conn_establish: fix the previous change - drop the reference on error.


To generate a diff of this commit:
cvs rdiff -u -r1.10.2.4 -r1.10.2.5 src/sys/net/npf/npf_conn.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/npf/npf_conn.c
diff -u src/sys/net/npf/npf_conn.c:1.10.2.4 src/sys/net/npf/npf_conn.c:1.10.2.5
--- src/sys/net/npf/npf_conn.c:1.10.2.4	Wed Feb  4 07:13:04 2015
+++ src/sys/net/npf/npf_conn.c	Sun Mar 15 22:41:24 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_conn.c,v 1.10.2.4 2015/02/04 07:13:04 snj Exp $	*/
+/*	$NetBSD: npf_conn.c,v 1.10.2.5 2015/03/15 22:41:24 snj Exp $	*/
 
 /*-
  * Copyright (c) 2014-2015 Mindaugas Rasiukevicius <rmind at netbsd org>
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.10.2.4 2015/02/04 07:13:04 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.10.2.5 2015/03/15 22:41:24 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -528,8 +528,8 @@ err:
 	 * here since there might be references acquired already.
 	 */
 	if (error) {
-		const u_int dflags = CONN_REMOVED | CONN_EXPIRE;
-		atomic_or_uint(&con->c_flags, dflags);
+		atomic_or_uint(&con->c_flags, CONN_REMOVED | CONN_EXPIRE);
+		atomic_dec_uint(&con->c_refcnt);
 		npf_stats_inc(NPF_STAT_RACE_CONN);
 	} else {
 		NPF_PRINTF(("NPF: establish conn %p\n", con));
@@ -569,6 +569,8 @@ npf_conn_destroy(npf_conn_t *con)
 /*
  * npf_conn_setnat: associate NAT entry with the connection, update and
  * re-insert connection entry using the translation values.
+ *
+ * => The caller must be holding a reference.
  */
 int
 npf_conn_setnat(const npf_cache_t *npc, npf_conn_t *con,

Reply via email to