From nobody Fri Nov 10 03:01:13 2023 X-Original-To: bugs@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 4SRNrB1Sgtz50j84 for ; Fri, 10 Nov 2023 03:01:14 +0000 (UTC) (envelope-from bugzilla-noreply@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 4SRNr96yqGz3VsG for ; Fri, 10 Nov 2023 03:01:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699585274; 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=UtlE7O9g00MS2/d1edBrlW/n6lhARwRC2biTW+Ncj2A=; b=R4Fc2sa5lifzlkEw7MCbOR4Ys/TvfVPtJeU7z48U8/ehgR+6VH1n9tg6tVeSf39yQVKlo/ E/NM5H1lRYmDF5Gn2E1qhoNKMFHiH6AQtL8atCZ/TW1hLm+JkFPOoWcwPTJudj27xhYkBH 0R6sccB2MFO322dz5CSHv/vaNh578AQ2xz4YoLMmarOm5l1HByGmKurroVz34lki/fYs8M R00ZIMCwJr0nV0O+2XXD61oSXgDLf9uT7fl60KAmKctPStIofDesUglVorZCJV+HX7ngFS 4kw04Fo6rrKo8xMrd3AbCS/x9y8mUsePRXboIlMKLFog9m83PWF4GMCkBVS87g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699585274; a=rsa-sha256; cv=none; b=pggbH/lIiJIfBNFPW++u9Vs1VammkoxNBTGAZv1KvisEK65QY27HFsQHvIZrcVZVz30DYw mP3sCFS/9l2qRemD5LA+FxjTrKjpTifXkg3IpnVZXMX/Qx7ZAqIOh4+03yJqdxCbCrUaJe RDqcNVqJPGI+N3iQElocL4Dn0sZb62Jd4U0I4dDxWykwxvtAf5nv5VstxyxvKSG0dwTrFP q4fctsuTbSp7w5cD/kDnzaxJFg8Bwd+NlVNBX1vCmQFeTcriB1rT5vqAM1Kbd0ItxdW/nR r9mHX3uoyQ5UfJpVTOtrA9EaaOLmJr95Yt+o0sS5mkrgH4jIOfjh3n4Q5gT/6A== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4SRNr964MFzhNg for ; Fri, 10 Nov 2023 03:01:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 3AA31DWZ023497 for ; Fri, 10 Nov 2023 03:01:13 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 3AA31DEr023496 for bugs@FreeBSD.org; Fri, 10 Nov 2023 03:01:13 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 275002] if_wg: Missing failure check for m_copyback() Date: Fri, 10 Nov 2023 03:01:13 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: aly@aaronly.me X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275002 Bug ID: 275002 Summary: if_wg: Missing failure check for m_copyback() Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: aly@aaronly.me Well, the m_copyback() may need to allocate new mbufs in order to hold the data, so the allocation may fail because it uses the 'M_NOWAIT' flag and doesn't provided any parameter to use the 'M_WAITOK' flag for allocation. = (For the reference, OpenBSD extended m_copyback() to have the extra 'how' parame= ter for this purpose.) As a consequence, the caller should check the resulting packet length for m_copyback() failure. Below is the patch to 'if_wg.c' function 'wg_send_buf()', please review. --- if_wg.c.orig 2023-10-12 09:06:16.983637264 +0800 +++ if_wg.c 2023-10-21 15:29:47.928807521 +0800 @@ -911,6 +911,11 @@ retry: goto out; } m_copyback(m, 0, len, buf); + if (m->m_pkthdr.len !=3D len) { + m_freem(m); + ret =3D ENOMEM; + goto out; + } if (ret =3D=3D 0) { ret =3D wg_send(sc, e, m); --=20 You are receiving this mail because: You are the assignee for the bug.=