From owner-svn-src-head@freebsd.org Thu Nov 17 23:56:59 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 636C0C476FA; Thu, 17 Nov 2016 23:56:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C1D61FB8; Thu, 17 Nov 2016 23:56:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id uAHNuvTR063939 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 17 Nov 2016 15:56:58 -0800 (PST) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id uAHNuvhE063938; Thu, 17 Nov 2016 15:56:57 -0800 (PST) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 17 Nov 2016 15:56:57 -0800 From: Gleb Smirnoff To: Sepherosa Ziehau Cc: "Bjoern A. Zeeb" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r308748 - head/sys/netgraph Message-ID: <20161117235657.GV27748@FreeBSD.org> References: <201611171403.uAHE3i3N044462@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.0 (2016-08-17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2016 23:56:59 -0000 On Thu, Nov 17, 2016 at 10:44:12PM +0800, Sepherosa Ziehau wrote: S> On Thu, Nov 17, 2016 at 10:03 PM, Bjoern A. Zeeb wrote: S> > Author: bz S> > Date: Thu Nov 17 14:03:44 2016 S> > New Revision: 308748 S> > URL: https://svnweb.freebsd.org/changeset/base/308748 S> > S> > Log: S> > Writing out the L2TP control packet requires 12 bytes of S> > contiguous memory but in one path we did not always guarantee this, S> > thus do a m_pullup() there. S> > S> > PR: 214385 S> > Submitted by: Joe Jones (joeknockando googlemail.com) S> > MFC after: 3 days S> > S> > Modified: S> > head/sys/netgraph/ng_l2tp.c S> > S> > Modified: head/sys/netgraph/ng_l2tp.c S> > ============================================================================== S> > --- head/sys/netgraph/ng_l2tp.c Thu Nov 17 11:48:07 2016 (r308747) S> > +++ head/sys/netgraph/ng_l2tp.c Thu Nov 17 14:03:44 2016 (r308748) S> > @@ -1544,6 +1544,16 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mb S> > priv->stats.memoryFailures++; S> > return (ENOBUFS); S> > } S> > + S> > + /* S> > + * The below requires 12 contiguous bytes for the L2TP header S> > + * to be written into. S> > + */ S> > + m = m_pullup(m, 12); S> > + if (m == NULL) { S> > + priv->stats.memoryFailures++; S> > + return (ENOBUFS); S> > + } S> S> Would it be better that we do a (m->m_len < 12) test before doing the S> m_pullup()? Yes, and a line like: if (m->m_len < 12 && (m = m_pullup(m, 12)) == NULL) will also match the style of the rest of the code in the function. -- Totus tuus, Glebius.