From nobody Wed Nov 13 19:29:34 2024 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 4XpYJG4C0tz5cTWk; Wed, 13 Nov 2024 19:29:34 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XpYJG2LNyz45n7; Wed, 13 Nov 2024 19:29:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731526174; 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=+HzN5ZtDsrZvpe5fm8ReZrOYumAbhiKn/NXLbNE7NBc=; b=v3HjX0fE2iGedGB37xC6zcxBKgJKP3m4DWxpCbYH2VFI8Z2VGR8hWJUNbYb4VAX1V15Vuy 3sAfsk2lk8hrHqBxHsV98Z4dAhskpbg3Kl65bED0XymDRYEOFgKwPC7PMzyODmhbMJW+qI U+nu7HHYVsD+UezFXnuOvZbjUEce8PmWv+npZYqevj6rtlifEN8ZMOvEbLTVdjhs3zYcsm U4eblyv62Hqop2REuj3RHnP8VGKdvnXT+k4Lx1tU239XAzrkEkRnxI1Ysv1SziWv9p6unZ l3aKrLbM5wNyEORVWOvyuVzwUVtqfiarkssp7DyJI+R54S8e17uLdVQZXVJXAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731526174; 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=+HzN5ZtDsrZvpe5fm8ReZrOYumAbhiKn/NXLbNE7NBc=; b=QCNayBMiMo7FJes4TmbXgGF5W8pk9WsB+Yhpf5oGRDDcOxPAPf1FtiprMrwxhoMLD1BuKC fiDYvqxuuxKKHJ3nQ+UPBPr5EhvTA2PoYi8t7Nj0a/OG1E/a1P+5/kVjtKoo2MTftzoN3y s5lhRtOt4eYFDBJbU8KrBxk2YC7kkrQqspbr9BejOZOgrcjmh32GqDetAyNBvcwrMJHFGq UZgFJF3+hyABE2IOtORlFcmZMRwQYIKzME7zAxxrcBiAtOKEcMwpWQbPxWDnfeqnO+65l0 089Re+CImdAaoloJ4O0XYxZjk2Qrj/weJDIh/9HerGVx6b6WCaOXvZa/dTijRg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731526174; a=rsa-sha256; cv=none; b=SldTTf1vNLSqycluky+MdW8JDgwDXscV95Iks3eWH5E+n3hDNIVd/kxFcfdBzbBJcknwgv gjtiJs0Ad0fgf/zVm5jnvAqXm4DlX7ELVenaWs+aqFyvEFWrRm0/x977FDgHI/og6w3EtZ pMwNWRjgIj5tAv3w3PFAdRksfLB9Uidep8mCzEDfrQsZ8JjV3HZBj0rkAIi1pGVVmtr+Zl BKeHFAuPk11QP8HCqeNrY5egoF/mVOb5o8J/IlcEOIZg9taYsZDVKcj4KKOxbxCRLa2dTy 5IU+z2Fi7ZMre5r0b9pSb/5lmASHMkUhBlHPRVoqeiBInUn5tES3V1BlTJjMbQ== 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 4XpYJG1pgMz16MF; Wed, 13 Nov 2024 19:29:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ADJTYDT033442; Wed, 13 Nov 2024 19:29:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ADJTYlQ033439; Wed, 13 Nov 2024 19:29:34 GMT (envelope-from git) Date: Wed, 13 Nov 2024 19:29:34 GMT Message-Id: <202411131929.4ADJTYlQ033439@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: b224af946a17 - main - netlink: Don't directly access ifnet members 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: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b224af946a17b8e7a7b4942157556b5bc86dd6fb Auto-Submitted: auto-generated The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=b224af946a17b8e7a7b4942157556b5bc86dd6fb commit b224af946a17b8e7a7b4942157556b5bc86dd6fb Author: Justin Hibbits AuthorDate: 2024-10-31 15:09:48 +0000 Commit: Justin Hibbits CommitDate: 2024-11-13 19:30:58 +0000 netlink: Don't directly access ifnet members Summary: Remove the final direct access of struct ifnet members from netlink. Since only the first address is used, create the iterator and then free, without fully iterating. Reviewed By: kp Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D42972 --- sys/netlink/route/iface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c index 7d33c89a396a..48fdab6a8475 100644 --- a/sys/netlink/route/iface.c +++ b/sys/netlink/route/iface.c @@ -322,11 +322,13 @@ dump_iface(struct nl_writer *nw, if_t ifp, const struct nlmsghdr *hdr, */ if (if_getaddrlen(ifp) != 0) { struct ifaddr *ifa; + struct ifa_iter it; NET_EPOCH_ENTER(et); - ifa = CK_STAILQ_FIRST(&ifp->if_addrhead); + ifa = ifa_iter_start(ifp, &it); if (ifa != NULL) dump_sa(nw, IFLA_ADDRESS, ifa->ifa_addr); + ifa_iter_finish(&it); NET_EPOCH_EXIT(et); }