svn commit: r307664 - stable/11/sys/netinet

Rick Macklem rmacklem at FreeBSD.org
Thu Oct 20 02:03:21 UTC 2016


Author: rmacklem
Date: Thu Oct 20 02:03:19 2016
New Revision: 307664
URL: https://svnweb.freebsd.org/changeset/base/307664

Log:
  MFC: r306559
  r297225 broke udp_output() for the case where the "addr" argument
  is NULL and the function jumps to the "release:" label.
  For this case, the "inp" was write locked, but the code attempted to
  read unlock it. This patch fixes the problem.
  This case could occur for NFS over UDP mounts, where the server was
  down for a few minutes under certain circumstances.

Modified:
  stable/11/sys/netinet/udp_usrreq.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/udp_usrreq.c
==============================================================================
--- stable/11/sys/netinet/udp_usrreq.c	Thu Oct 20 01:21:10 2016	(r307663)
+++ stable/11/sys/netinet/udp_usrreq.c	Thu Oct 20 02:03:19 2016	(r307664)
@@ -1559,12 +1559,18 @@ udp_output(struct inpcb *inp, struct mbu
 
 release:
 	if (unlock_udbinfo == UH_WLOCKED) {
+		KASSERT(unlock_inp == UH_WLOCKED,
+		    ("%s: excl udbinfo lock, shared inp lock", __func__));
 		INP_HASH_WUNLOCK(pcbinfo);
 		INP_WUNLOCK(inp);
 	} else if (unlock_udbinfo == UH_RLOCKED) {
+		KASSERT(unlock_inp == UH_RLOCKED,
+		    ("%s: shared udbinfo lock, excl inp lock", __func__));
 		INP_HASH_RUNLOCK(pcbinfo);
 		INP_RUNLOCK(inp);
-	} else
+	} else if (unlock_inp == UH_WLOCKED)
+		INP_WUNLOCK(inp);
+	else
 		INP_RUNLOCK(inp);
 	m_freem(m);
 	return (error);


More information about the svn-src-all mailing list