From nobody Fri Nov 04 11:00:26 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 4N3d2L56Lfz4hjSb; Fri, 4 Nov 2022 11:00:26 +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 4N3d2L4Yxgz3jjR; Fri, 4 Nov 2022 11:00:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667559626; 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=0sPhAVe7tZSz5GnwL20fiYzDyJMP1+QNJao4QrkKwTY=; b=kc+bM5GVtSCrdrrX+GtSdv8WTFSmfH2eJHVMOGhyyc+nU2DpdYwzufwlKuL0asrCK4yjMn fJd2fXg3wTN6E4Db3bztBZcO9u2AZfDls7/pzwRcOKyPJETNI/RSP0mYndnVpS8SYdhRMu m0cZdSihiKKJQIfi1coESnwbiSMAnQeIvr0ruBQGwkk9S6dWYNeXR/tITySJ5mkXoxCdvc 9AZ8FdfWiFiC1Pft8ju9aZbFZhACKaHXwBym+RVuouumjFRIK+G0TpQT5j4236WLW3lfeA xih3sDkj033ZOL5ZtkQeJu7ITP6JfxPtL+l5Gxhu42wwCmM1RtJ2gzF4zZsVcw== 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 4N3d2L3c0sz1DDr; Fri, 4 Nov 2022 11:00:26 +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 2A4B0Q6W023013; Fri, 4 Nov 2022 11:00:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2A4B0QfS023012; Fri, 4 Nov 2022 11:00:26 GMT (envelope-from git) Date: Fri, 4 Nov 2022 11:00:26 GMT Message-Id: <202211041100.2A4B0QfS023012@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: 639aebb2aa0b - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: 639aebb2aa0b72c569f8779e13351d37f7bb17c6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667559626; 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=0sPhAVe7tZSz5GnwL20fiYzDyJMP1+QNJao4QrkKwTY=; b=IStfDiSFhPJKYMdzgyguKeugo3m/Ke3z1RFSvUrI68nJp+xBkm2TUcsjDa2lycU/yR/UiW 5lnfow/n8V26yq0x6tPEpIYy0/R8hiow4gE+Os2WWxc7Cg35e17w3s8yMQTsQCBa9w7/gj JlEuN+EFbInWMiJ+W/U9DS9ib4Vi39LVHq3HicxrFTZY38Xend5CCuYRKpEZ26+LJuCzIl I7v8fZUPklBL+JK+0e1fpRUx+JtZ8pSp034lKN1CJpAvQu/AgKY7u+qMM3Gi/JxZpK1uMs 6CdgqphuqgAkv8/adns5PZ0b7hvCvR+sIifoJB9cOSeIzJJZvl0S76wO+CpEnA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667559626; a=rsa-sha256; cv=none; b=TlQqNgz6Ix8qF6OHzk0IRICKLC275newXKzCQ4QWxv5r3vYP1P/tWGhojDMg+lNwbHues1 N/6DFxHzjrY6aETIhLqg8m+ytOPtme+TZMVbdB+gaBGUCtKqG5ZXletbk5n0wYy6/kTbgK qVZC5g31PWmwdFmjMizvggqTtp8EZJgJST7+AhHnLT3KPpLqppVIBWzdnsTYxkn4EAbmxF u+D4D9z9zMNBQ1ZfJt34c8kxwx435w+NUUu5JrOn1AESl8G0LXAZhl7xazKKx+af4XwWLJ +Fh+5vvGGiD//515ERVXr/57aH9Pld0WFr1RqkSEPc9aMn1CQQZJBOADnt5xPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=639aebb2aa0b72c569f8779e13351d37f7bb17c6 commit 639aebb2aa0b72c569f8779e13351d37f7bb17c6 Author: Zhenlei Huang AuthorDate: 2022-09-30 07:55:29 +0000 Commit: Zhenlei Huang CommitDate: 2022-11-04 10:57:23 +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 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) {