From nobody Fri Nov 04 10:48:48 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 4N3cmw47YJz4hhCd; Fri, 4 Nov 2022 10:48:48 +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 4N3cmw3ZYFz3hWZ; Fri, 4 Nov 2022 10:48:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667558928; 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=VzeF2n8cQbHC431sW3rB1+deguF2fsNEFsD4gFQWZKQ=; b=C7eOriLKkMO1baI7JOBf+JeUKs6ZJ3zfBO7GnmvrJNqlMbWNQkIO/5BroD63A6Q1ys5VRr 1mbQ8PvgpLV8Z1ugPSGiacKNndJVTMWnTI8s48zgZaXFFFy8GvtB2JHgrdr7DD2CLgx3wL 5H5b7BTvnhq1dVCLsJ49EE7QSYsSMEn/Wse+lHqk/NutkUgrbE5MmKzAcR3ZGGOwy20ocC I8c5UkWS2uS4wHWHNgVr+TEHEJsR5XVzhtNkIakZ86rbrAc+NI3VZM+YdWtNNvVL6R5SL6 vG1mF5DP+SyzFQL7ObySHpyoRoEfBR/zbTAowQJft1doyqiJBBaCW73K2j0XGA== 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 4N3cmw2cf2z1Cns; Fri, 4 Nov 2022 10:48:48 +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 2A4AmmKo099648; Fri, 4 Nov 2022 10:48:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A4AmmTS099647; Fri, 4 Nov 2022 10:48:48 GMT (envelope-from git) Date: Fri, 4 Nov 2022 10:48:48 GMT Message-Id: <202211041048.2A4AmmTS099647@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 0156c3f1f760 - stable/13 - 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0156c3f1f7608bb1ce547bed6b60cb084db3e7eb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667558928; 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=VzeF2n8cQbHC431sW3rB1+deguF2fsNEFsD4gFQWZKQ=; b=eyUbnhLrqLYn7hOeJMwSo7bXsEpF7X8NAMW7UajfrkQCJv/r9fLjjxy8tXLIS2cE1HoxIX IJODgVPkC5wXwhsz9IcIOf3sHDsGRAntXOOMKd8WNyfXOiJYHVgjDSxtyLm2AM7ik+jS/a aS8fPE2ujPE5f2Cn6DyxxGQbk6LZ+vO3IhwocrKp20ZwDnr1oOfOZbcXcf1gQ+Kbtx3Bxx OVlH2DlTBlwqBGZBci62GUAqcywJdd+05/dSHgDle06AbWwslqkdGuzN9ZHSfN9zMSn34d Nx0ahs+vH/HRmB2yKZn/0eM7Er4kep/6D3FvOU8mziAzGHsW13wifzOBRplhhA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667558928; a=rsa-sha256; cv=none; b=ktYZMiX8I3gk2+bLdS4rFgR4Nj7pH65UR+oJZxbcY+K6jVtiArGovyEQBIuljCd+rccrYW DWVtTbanm6ryaKgbWceLT9Yb4ddl1wenFWOzPmNEweJ7R294vMFWUcL55lPzmKuNy8x/qy 51TpRKAWpbue4C76z64GhUIp2iKJ8QwOGkjBUOjGoIa6hJ2iadlQqbTSlKl1mfmQdZfP+X XAmEhrToIVlgQNxs0EI9h/2oAf1gYPk5Qk75JAe/dD1lfgcfT5gy+WZaQtcoLPU+j6X2UM l4kJXlSxHDf+iN+ZW3FeDdB/MvO0r7G6eg+oFV72sEiiOChLiPNrSOVAAmr7Jw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=0156c3f1f7608bb1ce547bed6b60cb084db3e7eb commit 0156c3f1f7608bb1ce547bed6b60cb084db3e7eb Author: Zhenlei Huang AuthorDate: 2022-09-30 07:55:29 +0000 Commit: Zhenlei Huang 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) {