[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231020011856.3244410-1-kuba@kernel.org>
Date: Thu, 19 Oct 2023 18:18:50 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org,
edumazet@...gle.com,
pabeni@...hat.com,
johannes.berg@...el.com,
mpe@...erman.id.au,
j@...fi,
jiri@...nulli.us
Subject: [PATCH net-next 0/6] net: deduplicate netdev name allocation
After recent fixes we have even more duplicated code in netdev name
allocation helpers. There are two complications in this code.
First, __dev_alloc_name() clobbers its output arg even if allocation
fails, forcing callers to do extra copies. Second as our experience in
commit 55a5ec9b7710 ("Revert "net: core: dev_get_valid_name is now the same as dev_alloc_name_ns"") and
commit 029b6d140550 ("Revert "net: core: maybe return -EEXIST in __dev_alloc_name"")
taught us, user space is very sensitive to the exact error codes.
Align the callers of __dev_alloc_name(), and remove some of its
complexity.
Jakub Kicinski (6):
net: don't use input buffer of __dev_alloc_name() as a scratch space
net: make dev_alloc_name() call dev_prep_valid_name()
net: reduce indentation of __dev_alloc_name()
net: trust the bitmap in __dev_alloc_name()
net: remove dev_valid_name() check from __dev_alloc_name()
net: remove else after return in dev_prep_valid_name()
net/core/dev.c | 120 +++++++++++++++++++------------------------------
1 file changed, 45 insertions(+), 75 deletions(-)
--
2.41.0
Powered by blists - more mailing lists