From nobody Tue Dec 9 19:59:12 2025 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 4dQqS10yQGz6Jj79 for ; Tue, 09 Dec 2025 19:59:13 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dQqS10NhSz3slJ for ; Tue, 09 Dec 2025 19:59:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765310353; 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=my7rUxY41Q/0RVx/MY/WS/GEiAqXl9cadZgZEgVW/QY=; b=jud+NebyqwopXKPM+WS6hR08JvR8fHZ7Fv/a265214kTq7M+/n0R1eKR896LucF2NtBLVX ZpJ5pOzrUh4jk3Z5Dm/PC+u1FZl04PwhVKd4GjniH2jQ+bW4MhWf83bCc+BQw8qlP5PFjB nXI2Kvz79ibPerrhUIEsea6HT6kYdIv0bftQdi9gWzFpvtak7f4rlg8mH9TxEnbtl/Lmpg B1al86Mt0ifqoE5m0cjZ1nDa/D7ASSFGQF8fYmb7L41UiiZ1b4os0xwFVy1NpuPNYiqGXU fGqvxK86JkBR+YQIySMj+E7JELNj43yppayypZ1/SRTDtS/zBwePt0JOU36eVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765310353; 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=my7rUxY41Q/0RVx/MY/WS/GEiAqXl9cadZgZEgVW/QY=; b=D4vp7arrElmEhHhB6lii/T5zzP6PblNYe/sLowUHd/bXQ3EZs+mVPxUFcgOmHoamGEAbwR pi+8X3fhF1yEOYmENfXfZLwneIUevsuqm7Kk/lMLv9qV/e1G/rXdDZ/gEIPniiMUrCkuhi S4SHYjWS4zbHX6RafVXqk2kzvz7oNR4r2SIJjAXUMwDjgRa+lE68rvH3jszY3JKCMNnMD2 1oZs4m3+FV/lpCyYf4+/9pfKby5a8GPfjbSNvLe51TOIE/ylzmhAm5M8aqzoDxNahYUUvw Uge05aRDdZL8XVeuarE0XpAoC7ZewIb511MDmP4G6skvOlycAqhXm4oemHM9uA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1765310353; a=rsa-sha256; cv=none; b=GWh8OtWEy+6psIrY+teklzc+B6Dl51lu0Ue72/U8Iqvl9kHKokfLEo57U7dWKEc98qleUz oSCl62wJzeL7+IyrteRj72Gul43juibiD/nKezIP6DXliZDITSBt1SUVCP4HOR/63HFCuf ThmbQ0yKX5U1wM5gZpGYm6+J4s4J7fk2ccj01zKrWBrs9hSLwVM5FLgkcjanYDXB8J/k8d Bap9EJ/ge0NdaJRhWcLGV6QmMOcNFh9WARg3ZHB9BmMq+XdK1vZ4PHdbSetQFA40kalusq tr0ggKi5zZZnzH3L8zbJvCBhzuganLbFLNlw1H/eLESFuS0GpXguibK0QvP9UQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dQqS06n7Jz1BqW for ; Tue, 09 Dec 2025 19:59:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2e589 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 09 Dec 2025 19:59:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 12165ac8407c - main - Revert "netlink: Fix overallocation of netlink message buffers" 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 12165ac8407cef2c0b96035a1a956e3a7fe48cec Auto-Submitted: auto-generated Date: Tue, 09 Dec 2025 19:59:12 +0000 Message-Id: <69387f90.2e589.323f82c3@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=12165ac8407cef2c0b96035a1a956e3a7fe48cec commit 12165ac8407cef2c0b96035a1a956e3a7fe48cec Author: John Baldwin AuthorDate: 2025-12-09 19:55:46 +0000 Commit: John Baldwin CommitDate: 2025-12-09 19:55:46 +0000 Revert "netlink: Fix overallocation of netlink message buffers" This patch was based on an incorrect assumption that the linear buffer chain for an snl_writer only contained the netlink message body. This reverts commit 828df4d36d9d5a6ca0dcc294d65572b4a0474142. Sponsored by: AFRL, DARPA --- sys/netlink/netlink_snl.h | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index 1e560e029718..57f7e1e29d08 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -1082,7 +1082,6 @@ snl_init_writer(struct snl_state *ss, struct snl_writer *nw) static inline bool snl_realloc_msg_buffer(struct snl_writer *nw, size_t sz) { - void *new_base; uint32_t new_size = nw->size * 2; while (new_size < nw->size + sz) @@ -1091,27 +1090,23 @@ snl_realloc_msg_buffer(struct snl_writer *nw, size_t sz) if (nw->error) return (false); - new_base = snl_allocz(nw->ss, new_size); - if (new_base == NULL) { + if (snl_allocz(nw->ss, new_size) == NULL) { nw->error = true; return (false); } + nw->size = new_size; - if (new_base == nw->ss->lb->base) { - /* Claim the entire linear buffer. */ - nw->size = nw->ss->lb->size; - nw->ss->lb->offset = nw->ss->lb->size; - } else - nw->size = new_size; - - memcpy(new_base, nw->base, nw->offset); - if (nw->hdr != NULL) { - int hdr_off = (char *)(nw->hdr) - nw->base; + void *new_base = nw->ss->lb->base; + if (new_base != nw->base) { + memcpy(new_base, nw->base, nw->offset); + if (nw->hdr != NULL) { + int hdr_off = (char *)(nw->hdr) - nw->base; - nw->hdr = (struct nlmsghdr *) - (void *)((char *)new_base + hdr_off); + nw->hdr = (struct nlmsghdr *) + (void *)((char *)new_base + hdr_off); + } + nw->base = (char *)new_base; } - nw->base = (char *)new_base; return (true); }