* [PATCH net] ethtool: mark netlink policy as __ro_after_init
@ 2020-09-29 0:57 Jakub Kicinski
2020-09-29 0:58 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Kicinski @ 2020-09-29 0:57 UTC (permalink / raw)
To: davem; +Cc: mkubecek, netdev, Jakub Kicinski
Like all genl families ethtool_genl_family needs to not
be a straight up constant, because it's modified/initialized
by genl_register_family(). After init, however, it's only
passed to genlmsg_put() & co. therefore we can mark it
as __ro_after_init.
Since genl_family structure contains function pointers
mark this as a fix.
Fixes: 2b4a8990b7df ("ethtool: introduce ethtool netlink interface")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/ethtool/netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index 5c2072765be7..0c3f54baec4e 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -866,7 +866,7 @@ static const struct genl_multicast_group ethtool_nl_mcgrps[] = {
[ETHNL_MCGRP_MONITOR] = { .name = ETHTOOL_MCGRP_MONITOR_NAME },
};
-static struct genl_family ethtool_genl_family = {
+static struct genl_family ethtool_genl_family __ro_after_init = {
.name = ETHTOOL_GENL_NAME,
.version = ETHTOOL_GENL_VERSION,
.netnsok = true,
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] ethtool: mark netlink policy as __ro_after_init
2020-09-29 0:57 [PATCH net] ethtool: mark netlink policy as __ro_after_init Jakub Kicinski
@ 2020-09-29 0:58 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-09-29 0:58 UTC (permalink / raw)
To: davem; +Cc: mkubecek, netdev
On Mon, 28 Sep 2020 17:57:18 -0700 Jakub Kicinski wrote:
> Like all genl families ethtool_genl_family needs to not
> be a straight up constant, because it's modified/initialized
> by genl_register_family(). After init, however, it's only
> passed to genlmsg_put() & co. therefore we can mark it
> as __ro_after_init.
Sorry I just realized the subject is off.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-29 0:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 0:57 [PATCH net] ethtool: mark netlink policy as __ro_after_init Jakub Kicinski
2020-09-29 0:58 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).