From owner-dev-commits-src-all@freebsd.org Thu Jun 10 09:33:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C901D646E50; Thu, 10 Jun 2021 09:33:47 +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 4G0zLg5JtLz3mry; Thu, 10 Jun 2021 09:33:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9F62A54BC; Thu, 10 Jun 2021 09:33:47 +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 15A9Xl2E033354; Thu, 10 Jun 2021 09:33:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15A9XltM033353; Thu, 10 Jun 2021 09:33:47 GMT (envelope-from git) Date: Thu, 10 Jun 2021 09:33:47 GMT Message-Id: <202106100933.15A9XltM033353@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Lutz Donnerhacke Subject: git: a0694da5d035 - stable/12 - netgraph/ng_base: Renaming a node to the same name is a noop MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a0694da5d035ea0e686ad1bae95709e52df0913a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2021 09:33:47 -0000 The branch stable/12 has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=a0694da5d035ea0e686ad1bae95709e52df0913a commit a0694da5d035ea0e686ad1bae95709e52df0913a Author: Lutz Donnerhacke AuthorDate: 2021-05-04 19:20:39 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-06-10 09:33:19 +0000 netgraph/ng_base: Renaming a node to the same name is a noop Detailed analysis in https://github.com/genneko/freebsd-vimage-jails/issues/2 brought the problem down to a double call of ng_node_name() before and after a vnet move. Because the name of the node is already known (occupied by itself), the second call fails. PR: 241954 Reported by: Paul Armstrong Differential Revision: https://reviews.freebsd.org/D30110 (cherry picked from commit 0345fd891fe13a191fc0fae9463ea9458bfaff5a) --- sys/netgraph/ng_base.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 4c6a2f606119..f7c2cdb9afb0 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -854,6 +854,10 @@ ng_name_node(node_p node, const char *name) node_p node2; int i; + /* Rename without change is a noop */ + if (strcmp(NG_NODE_NAME(node), name) == 0) + return (0); + /* Check the name is valid */ for (i = 0; i < NG_NODESIZ; i++) { if (name[i] == '\0' || name[i] == '.' || name[i] == ':')