Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Nov 2022 10:48:48 GMT
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0156c3f1f760 - stable/13 - if_vxlan(4): Check the size of data available in mbuf before using them
Message-ID:  <202211041048.2A4AmmTS099647@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=0156c3f1f7608bb1ce547bed6b60cb084db3e7eb

commit 0156c3f1f7608bb1ce547bed6b60cb084db3e7eb
Author:     Zhenlei Huang <zlei.huang@gmail.com>
AuthorDate: 2022-09-30 07:55:29 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2022-11-04 10:38:50 +0000

    if_vxlan(4): Check the size of data available in mbuf before using them
    
    PR:             261711
    Reviewed by:    kp
    Tested by:      Alfa (burak.sn at outlook.com)
    Approved by:    kp (mentor)
    Differential Revision:  https://reviews.freebsd.org/D36794
    
    (cherry picked from commit 8707cb19e68128c181477d87f960182c14e15f12)
---
 sys/net/if_vxlan.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 63b4af0fc635..c8bb1ac53981 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -2822,6 +2822,12 @@ vxlan_input(struct vxlan_socket *vso, uint32_t vni, struct mbuf **m0,
 		return (ENOENT);
 
 	ifp = sc->vxl_ifp;
+	if (m->m_len < ETHER_HDR_LEN &&
+	    (m = m_pullup(m, ETHER_HDR_LEN)) == NULL) {
+		*m0 = NULL;
+		error = ENOBUFS;
+		goto out;
+	}
 	eh = mtod(m, struct ether_header *);
 
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {



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