Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Oct 2019 02:34:52 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353027 - head/sys/netgraph
Message-ID:  <201910030234.x932YqND020346@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Thu Oct  3 02:34:51 2019
New Revision: 353027
URL: https://svnweb.freebsd.org/changeset/base/353027

Log:
  Protect access to seq->xwin[] with the seq mutex.
  
  MFC after:	5 weeks

Modified:
  head/sys/netgraph/ng_l2tp.c

Modified: head/sys/netgraph/ng_l2tp.c
==============================================================================
--- head/sys/netgraph/ng_l2tp.c	Thu Oct  3 02:32:55 2019	(r353026)
+++ head/sys/netgraph/ng_l2tp.c	Thu Oct  3 02:34:51 2019	(r353027)
@@ -1462,6 +1462,7 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, voi
 	/* Sanity check */
 	L2TP_SEQ_CHECK(seq);
 
+	mtx_lock(&seq->mtx);
 	priv->stats.xmitRetransmits++;
 
 	/* Have we reached the retransmit limit? If so, notify owner. */
@@ -1482,7 +1483,9 @@ ng_l2tp_seq_rack_timeout(node_p node, hook_p hook, voi
 	seq->acks = 0;
 
 	/* Retransmit oldest unack'd packet */
-	if ((m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT)) == NULL)
+	m = L2TP_COPY_MBUF(seq->xwin[0], M_NOWAIT);
+	mtx_unlock(&seq->mtx);
+	if (m == NULL)
 		priv->stats.memoryFailures++;
 	else
 		ng_l2tp_xmit_ctrl(priv, m, seq->ns++);



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