From nobody Fri Nov 04 12:22:33 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N3fs574pGz4gf6D; Fri, 4 Nov 2022 12:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N3fs56fp9z3rdq; Fri, 4 Nov 2022 12:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667564553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cnAmvP0j7sZJu1XRIiXnBx751kci4lir8ImCgsF3PiI=; b=ncBUKZm7jXZo77cjQ9Ysau4y1xseIejim23gw13cunkWsBwPMqllLhbCVnh9rPXgkzdpY5 ot3pnPGKkppZfFz9BSe8orT7E/RXCdTqaiT49A4yARByI1ywu3UklGbVhiXMEayNwFg81l jINeihJ9UAvys173NtbHivOL0oHoCqdLYf+GRPhkM9pINXzQJGeqV2w8ygBGjuiqsy+6Q0 GIQfj20OAYqduodjYITOweGnVhuIa8Ifem72BZ2rAXkuc70aYBDogkiisRpM38aQ5B2zGl /GRGW7novcVeVf4+kyBTSiQe01/hBFFZvpwsMQ6uEkChyHA1RnCUwUceBJEwMg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N3fs55kQZz1GMl; Fri, 4 Nov 2022 12:22:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2A4CMXG4041405; Fri, 4 Nov 2022 12:22:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A4CMXiQ041404; Fri, 4 Nov 2022 12:22:33 GMT (envelope-from git) Date: Fri, 4 Nov 2022 12:22:33 GMT Message-Id: <202211041222.2A4CMXiQ041404@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: a9c3d5de9ac8 - releng/12.4 - if_vxlan(4): Check the size of data available in mbuf before using them List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/releng/12.4 X-Git-Reftype: branch X-Git-Commit: a9c3d5de9ac8ae8090881f20c894d3577d97e92a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667564553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cnAmvP0j7sZJu1XRIiXnBx751kci4lir8ImCgsF3PiI=; b=lzTkbl9MBkdZi+F00uQ56oGMJkmqv40rIb19D72uX9yrNePs+5DhdADfuMSx4Jcm1HUfmh o/YkYuvuP2XVtKN/quvTr+NHiG/yMldeZEYeu5N9W8iyxFc2Z2vexDhD3YlMbmVWKEQ665 bG9TQUDSo/gNwNpGuz0RzNuFi0/jTPTM5hJcn6RVCYncDk1FFwY5uYQXED8yxLUMWjEETT Czq8i9J/IZhPArELDski7P71QanSNWml16qeZyfosf4PKm0JKmc52P5m3jADl+DLbC2rfc wFHmA449iJjufJwoFfGl0LOqP5VW9OjISzrIfloqWRnAC3LbN/X8t+rF5ei2iA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667564553; a=rsa-sha256; cv=none; b=I20Y8Xa67sq3GyplWaIwxar2mZlX5yR8pYLFBagEjib2wmGHUKDNQPRt2zJFjZaeKiPdiA oWc+Y1YwNj45BSeoTmeVjDe2DLgjDSDdH6PqsHwAZ+PzJaL/iuQlXEF7Kga3j05wVGdhK2 T0+mrO2hTQf/ONJTfxR2tYRvK+yIHjzJcg2laUgs5ShIw0d4t8xkSexB6iocVYCADZY7Sw ebVbSN+Xj6JdiR6Mc8+h3Gzlvfk8YuRiMRiJtrUlsdrVFYbGvHash2Iv2FlnOsr+z2LebV rd8xyevTij/IXO3SBDZ5Buj0kkUYez0LdXx4rRcWXbTkjfwU1yIN+PIE5p4/bw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/12.4 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a9c3d5de9ac8ae8090881f20c894d3577d97e92a commit a9c3d5de9ac8ae8090881f20c894d3577d97e92a Author: Zhenlei Huang AuthorDate: 2022-09-30 07:55:29 +0000 Commit: Kristof Provost CommitDate: 2022-11-04 12:21:45 +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: re (gjb), kp (mentor) Differential Revision: https://reviews.freebsd.org/D36794 (cherry picked from commit 8707cb19e68128c181477d87f960182c14e15f12) (cherry picked from commit 639aebb2aa0b72c569f8779e13351d37f7bb17c6) --- 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 17f96727ca12..67aa760f7fcf 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -2560,6 +2560,12 @@ vxlan_input(struct vxlan_socket *vso, uint32_t vni, struct mbuf **m0, ifp = sc->vxl_ifp; m = *m0; + 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) {