Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jun 2018 06:10:53 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335468 - head/sys/netinet
Message-ID:  <201806210610.w5L6ArWm086374@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmacy
Date: Thu Jun 21 06:10:52 2018
New Revision: 335468
URL: https://svnweb.freebsd.org/changeset/base/335468

Log:
  udp_ctlinput: don't refer to unpcb after we drop the lock
  
  Reported by: pho@

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c	Thu Jun 21 05:28:00 2018	(r335467)
+++ head/sys/netinet/udp_usrreq.c	Thu Jun 21 06:10:52 2018	(r335468)
@@ -802,14 +802,15 @@ udp_common_ctlinput(int cmd, struct sockaddr *sa, void
 					   INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, NULL);
 			if (inp != NULL) {
 				struct udpcb *up;
+				void *ctx;
+				udp_tun_icmp_t func;
 
 				up = intoudpcb(inp);
-				if (up->u_icmp_func != NULL) {
-					INP_RUNLOCK(inp);
-					(*up->u_icmp_func)(cmd, sa, vip, up->u_tun_ctx);
-				} else {
-					INP_RUNLOCK(inp);
-				}
+				ctx = up->u_tun_ctx;
+				func = up->u_icmp_func;
+				INP_RUNLOCK(inp);
+				if (func != NULL)
+					(*func)(cmd, sa, vip, ctx);
 			}
 		}
 	} else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806210610.w5L6ArWm086374>