From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jiri Pirko <jiri@nvidia.com>, Ido Schimmel <idosch@nvidia.com>,
Jakub Kicinski <kuba@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>,
edumazet@google.com, pabeni@redhat.com, jiri@resnulli.us,
jacob.e.keller@intel.com, michal.wilczynski@intel.com,
shayd@nvidia.com, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.10 01/14] devlink: remove reload failed checks in params get/set callbacks
Date: Fri, 8 Sep 2023 14:19:48 -0400 [thread overview]
Message-ID: <20230908182003.3460721-1-sashal@kernel.org> (raw)
From: Jiri Pirko <jiri@nvidia.com>
[ Upstream commit 633d76ad01ad0321a1ace3e5cc4fed06753d7ac4 ]
The checks in question were introduced by:
commit 6b4db2e528f6 ("devlink: Fix use-after-free after a failed reload").
That fixed an issue of reload with mlxsw driver.
Back then, that was a valid fix, because there was a limitation
in place that prevented drivers from registering/unregistering params
when devlink instance was registered.
It was possible to do the fix differently by changing drivers to
register/unregister params in appropriate places making sure the ops
operate only on memory which is allocated and initialized. But that,
as a dependency, would require to remove the limitation mentioned above.
Eventually, this limitation was lifted by:
commit 1d18bb1a4ddd ("devlink: allow registering parameters after the instance")
Also, the alternative fix (which also fixed another issue) was done by:
commit 74cbc3c03c82 ("mlxsw: spectrum_acl_tcam: Move devlink param to TCAM code").
Therefore, the checks are no longer relevant. Each driver should make
sure to have the params registered only when the memory the ops
are working with is allocated and initialized.
So remove the checks.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/core/devlink.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 00c6944ed6342..38666dde89340 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -3620,7 +3620,7 @@ static int devlink_param_get(struct devlink *devlink,
const struct devlink_param *param,
struct devlink_param_gset_ctx *ctx)
{
- if (!param->get || devlink->reload_failed)
+ if (!param->get)
return -EOPNOTSUPP;
return param->get(devlink, param->id, ctx);
}
@@ -3629,7 +3629,7 @@ static int devlink_param_set(struct devlink *devlink,
const struct devlink_param *param,
struct devlink_param_gset_ctx *ctx)
{
- if (!param->set || devlink->reload_failed)
+ if (!param->set)
return -EOPNOTSUPP;
return param->set(devlink, param->id, ctx);
}
--
2.40.1
next reply other threads:[~2023-09-08 19:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 18:19 Sasha Levin [this message]
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 02/14] crypto: lrw,xts - Replace strlcpy with strscpy Sasha Levin
2023-09-11 9:41 ` Pavel Machek
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 03/14] wifi: ath9k: fix fortify warnings Sasha Levin
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 04/14] wifi: ath9k: fix printk specifier Sasha Levin
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 05/14] wifi: mwifiex: fix fortify warning Sasha Levin
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 06/14] wifi: wil6210: fix fortify warnings Sasha Levin
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 07/14] crypto: lib/mpi - avoid null pointer deref in mpi_cmp_ui() Sasha Levin
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 08/14] tpm_tis: Resend command to recover from data transfer errors Sasha Levin
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 09/14] mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450 Sasha Levin
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 10/14] alx: fix OOB-read compiler warning Sasha Levin
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 11/14] netfilter: ebtables: fix fortify warnings in size_entry_mwt() Sasha Levin
2023-09-08 18:19 ` [PATCH AUTOSEL 5.10 12/14] wifi: mac80211_hwsim: drop short frames Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.10 13/14] libbpf: Free btf_vmlinux when closing bpf_object Sasha Levin
2023-09-08 18:20 ` [PATCH AUTOSEL 5.10 14/14] Bluetooth: btusb: Fix quirks table naming Sasha Levin
2023-09-08 21:44 ` [PATCH AUTOSEL 5.10 01/14] devlink: remove reload failed checks in params get/set callbacks Jacob Keller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230908182003.3460721-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=jacob.e.keller@intel.com \
--cc=jiri@nvidia.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.wilczynski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shayd@nvidia.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox