Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Mar 2024 20:57:10 GMT
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2f5a315b3074 - main - linux: require vnet(9) context in ifname_bsd_to_linux_name()
Message-ID:  <202403032057.423KvAAr089009@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f5a315b307447f91891c96fb23c7333fa406f2f

commit 2f5a315b307447f91891c96fb23c7333fa406f2f
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-03-03 20:56:58 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-03-03 20:56:58 +0000

    linux: require vnet(9) context in ifname_bsd_to_linux_name()
    
    This function is used by netlink(9) only.  The netlink(9) taskqueue thread
    runs in the vnet of the socket whose request the thread is processing
    right now.  This is a correct vnet and resetting it to vnet0 is incorrect.
    If the function is to be used by any other caller in addition to
    netlink(9), it would be caller's responsiblity to provide correct vnet(9).
    
    Reviewed by:            melifaro, dchagin
    Differential Revision:  https://reviews.freebsd.org/D44191
    PR:                     277286
---
 sys/compat/linux/linux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c
index 569f9ffe1617..69849b1d98ad 100644
--- a/sys/compat/linux/linux.c
+++ b/sys/compat/linux/linux.c
@@ -253,14 +253,14 @@ ifname_bsd_to_linux_name(const char *bsdname, char *lxname, size_t len)
 	struct ifnet *ifp;
 	int ret;
 
+	CURVNET_ASSERT_SET();
+
 	ret = 0;
-	CURVNET_SET(TD_TO_VNET(curthread));
 	NET_EPOCH_ENTER(et);
 	ifp = ifunit(bsdname);
 	if (ifp != NULL)
 		ret = ifname_bsd_to_linux_ifp(ifp, lxname, len);
 	NET_EPOCH_EXIT(et);
-	CURVNET_RESTORE();
 	return (ret);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202403032057.423KvAAr089009>