Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Nov 2016 22:44:12 +0800
From:      Sepherosa Ziehau <sepherosa@gmail.com>
To:        "Bjoern A. Zeeb" <bz@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r308748 - head/sys/netgraph
Message-ID:  <CAMOc5czJePr9ObomdsSLKgHOov_iVUoN4KLzqGpdXZ%2B9JccA3w@mail.gmail.com>
In-Reply-To: <201611171403.uAHE3i3N044462@repo.freebsd.org>
References:  <201611171403.uAHE3i3N044462@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 17, 2016 at 10:03 PM, Bjoern A. Zeeb <bz@freebsd.org> wrote:
> Author: bz
> Date: Thu Nov 17 14:03:44 2016
> New Revision: 308748
> URL: https://svnweb.freebsd.org/changeset/base/308748
>
> Log:
>   Writing out the L2TP control packet requires 12 bytes of
>   contiguous memory but in one path we did not always guarantee this,
>   thus do a m_pullup() there.
>
>   PR:                   214385
>   Submitted by:         Joe Jones (joeknockando googlemail.com)
>   MFC after:            3 days
>
> Modified:
>   head/sys/netgraph/ng_l2tp.c
>
> Modified: head/sys/netgraph/ng_l2tp.c
> ==============================================================================
> --- head/sys/netgraph/ng_l2tp.c Thu Nov 17 11:48:07 2016        (r308747)
> +++ head/sys/netgraph/ng_l2tp.c Thu Nov 17 14:03:44 2016        (r308748)
> @@ -1544,6 +1544,16 @@ ng_l2tp_xmit_ctrl(priv_p priv, struct mb
>                         priv->stats.memoryFailures++;
>                         return (ENOBUFS);
>                 }
> +
> +               /*
> +                * The below requires 12 contiguous bytes for the L2TP header
> +                * to be written into.
> +                */
> +               m = m_pullup(m, 12);
> +               if (m == NULL) {
> +                       priv->stats.memoryFailures++;
> +                       return (ENOBUFS);
> +               }

Would it be better that we do a (m->m_len < 12) test before doing the
m_pullup()?

Thanks,
sephe

-- 
Tomorrow Will Never Die



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMOc5czJePr9ObomdsSLKgHOov_iVUoN4KLzqGpdXZ%2B9JccA3w>