mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 12:14:10 +08:00
sysctl: treewide: constify ctl_table_header::ctl_table_arg
To be able to constify instances of struct ctl_tables it is necessary to remove ways through which non-const versions are exposed from the sysctl core. One of these is the ctl_table_arg member of struct ctl_table_header. Constify this reference as a prerequisite for the full constification of struct ctl_table instances. No functional change. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
8442f8ba26
commit
bfa858f220
@ -1971,7 +1971,7 @@ static int vrf_netns_init_sysctl(struct net *net, struct netns_vrf *nn_vrf)
|
||||
static void vrf_netns_exit_sysctl(struct net *net)
|
||||
{
|
||||
struct netns_vrf *nn_vrf = net_generic(net, vrf_net_id);
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = nn_vrf->ctl_hdr->ctl_table_arg;
|
||||
unregister_net_sysctl_table(nn_vrf->ctl_hdr);
|
||||
|
@ -182,7 +182,7 @@ struct ctl_table_header {
|
||||
struct rcu_head rcu;
|
||||
};
|
||||
struct completion *unregistering;
|
||||
struct ctl_table *ctl_table_arg;
|
||||
const struct ctl_table *ctl_table_arg;
|
||||
struct ctl_table_root *root;
|
||||
struct ctl_table_set *set;
|
||||
struct ctl_dir *parent;
|
||||
|
@ -306,7 +306,7 @@ bool setup_ipc_sysctls(struct ipc_namespace *ns)
|
||||
|
||||
void retire_ipc_sysctls(struct ipc_namespace *ns)
|
||||
{
|
||||
struct ctl_table *tbl;
|
||||
const struct ctl_table *tbl;
|
||||
|
||||
tbl = ns->ipc_sysctls->ctl_table_arg;
|
||||
unregister_sysctl_table(ns->ipc_sysctls);
|
||||
|
@ -160,7 +160,7 @@ bool setup_mq_sysctls(struct ipc_namespace *ns)
|
||||
|
||||
void retire_mq_sysctls(struct ipc_namespace *ns)
|
||||
{
|
||||
struct ctl_table *tbl;
|
||||
const struct ctl_table *tbl;
|
||||
|
||||
tbl = ns->mq_sysctls->ctl_table_arg;
|
||||
unregister_sysctl_table(ns->mq_sysctls);
|
||||
|
@ -119,7 +119,7 @@ bool setup_userns_sysctls(struct user_namespace *ns)
|
||||
void retire_userns_sysctls(struct user_namespace *ns)
|
||||
{
|
||||
#ifdef CONFIG_SYSCTL
|
||||
struct ctl_table *tbl;
|
||||
const struct ctl_table *tbl;
|
||||
|
||||
tbl = ns->sysctls->ctl_table_arg;
|
||||
unregister_sysctl_table(ns->sysctls);
|
||||
|
@ -171,7 +171,7 @@ int ax25_register_dev_sysctl(ax25_dev *ax25_dev)
|
||||
void ax25_unregister_dev_sysctl(ax25_dev *ax25_dev)
|
||||
{
|
||||
struct ctl_table_header *header = ax25_dev->sysheader;
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
if (header) {
|
||||
ax25_dev->sysheader = NULL;
|
||||
|
@ -1275,7 +1275,7 @@ static int br_netfilter_sysctl_init_net(struct net *net)
|
||||
static void br_netfilter_sysctl_exit_net(struct net *net,
|
||||
struct brnf_net *brnet)
|
||||
{
|
||||
struct ctl_table *table = brnet->ctl_hdr->ctl_table_arg;
|
||||
const struct ctl_table *table = brnet->ctl_hdr->ctl_table_arg;
|
||||
|
||||
unregister_net_sysctl_table(brnet->ctl_hdr);
|
||||
if (!net_eq(net, &init_net))
|
||||
|
@ -743,7 +743,7 @@ err_dup:
|
||||
|
||||
static __net_exit void sysctl_core_net_exit(struct net *net)
|
||||
{
|
||||
struct ctl_table *tbl;
|
||||
const struct ctl_table *tbl;
|
||||
|
||||
tbl = net->core.sysctl_hdr->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->core.sysctl_hdr);
|
||||
|
@ -399,7 +399,7 @@ err_alloc:
|
||||
|
||||
static void __net_exit lowpan_frags_ns_sysctl_unregister(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
struct netns_ieee802154_lowpan *ieee802154_lowpan =
|
||||
net_ieee802154_lowpan(net);
|
||||
|
||||
|
@ -2749,7 +2749,7 @@ err_alloc_all:
|
||||
static __net_exit void devinet_exit_net(struct net *net)
|
||||
{
|
||||
#ifdef CONFIG_SYSCTL
|
||||
struct ctl_table *tbl;
|
||||
const struct ctl_table *tbl;
|
||||
|
||||
tbl = net->ipv4.forw_hdr->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->ipv4.forw_hdr);
|
||||
|
@ -632,7 +632,7 @@ err_alloc:
|
||||
|
||||
static void __net_exit ip4_frags_ns_ctl_unregister(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = net->ipv4.frags_hdr->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->ipv4.frags_hdr);
|
||||
|
@ -3576,7 +3576,7 @@ err_dup:
|
||||
|
||||
static __net_exit void sysctl_route_net_exit(struct net *net)
|
||||
{
|
||||
struct ctl_table *tbl;
|
||||
const struct ctl_table *tbl;
|
||||
|
||||
tbl = net->ipv4.route_hdr->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->ipv4.route_hdr);
|
||||
|
@ -1554,7 +1554,7 @@ err_alloc:
|
||||
|
||||
static __net_exit void ipv4_sysctl_exit_net(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
kfree(net->ipv4.sysctl_local_reserved_ports);
|
||||
table = net->ipv4.ipv4_hdr->ctl_table_arg;
|
||||
|
@ -186,7 +186,7 @@ err_alloc:
|
||||
|
||||
static __net_exit void xfrm4_net_sysctl_exit(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
if (!net->ipv4.xfrm4_hdr)
|
||||
return;
|
||||
|
@ -7238,7 +7238,7 @@ out:
|
||||
static void __addrconf_sysctl_unregister(struct net *net,
|
||||
struct ipv6_devconf *p, int ifindex)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
if (!p->sysctl_header)
|
||||
return;
|
||||
|
@ -105,7 +105,7 @@ err_alloc:
|
||||
static void __net_exit nf_ct_frags6_sysctl_unregister(struct net *net)
|
||||
{
|
||||
struct nft_ct_frag6_pernet *nf_frag = nf_frag_pernet(net);
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = nf_frag->nf_frag_frags_hdr->ctl_table_arg;
|
||||
unregister_net_sysctl_table(nf_frag->nf_frag_frags_hdr);
|
||||
|
@ -487,7 +487,7 @@ err_alloc:
|
||||
|
||||
static void __net_exit ip6_frags_ns_sysctl_unregister(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = net->ipv6.sysctl.frags_hdr->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->ipv6.sysctl.frags_hdr);
|
||||
|
@ -313,9 +313,9 @@ out_ipv6_table:
|
||||
|
||||
static void __net_exit ipv6_sysctl_net_exit(struct net *net)
|
||||
{
|
||||
struct ctl_table *ipv6_table;
|
||||
struct ctl_table *ipv6_route_table;
|
||||
struct ctl_table *ipv6_icmp_table;
|
||||
const struct ctl_table *ipv6_table;
|
||||
const struct ctl_table *ipv6_route_table;
|
||||
const struct ctl_table *ipv6_icmp_table;
|
||||
|
||||
ipv6_table = net->ipv6.sysctl.hdr->ctl_table_arg;
|
||||
ipv6_route_table = net->ipv6.sysctl.route_hdr->ctl_table_arg;
|
||||
|
@ -218,7 +218,7 @@ err_alloc:
|
||||
|
||||
static void __net_exit xfrm6_net_sysctl_exit(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
if (!net->ipv6.sysctl.xfrm6_hdr)
|
||||
return;
|
||||
|
@ -1422,7 +1422,7 @@ static void mpls_dev_sysctl_unregister(struct net_device *dev,
|
||||
struct mpls_dev *mdev)
|
||||
{
|
||||
struct net *net = dev_net(dev);
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
if (!mdev->sysctl)
|
||||
return;
|
||||
@ -2690,7 +2690,7 @@ static void mpls_net_exit(struct net *net)
|
||||
{
|
||||
struct mpls_route __rcu **platform_label;
|
||||
size_t platform_labels;
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
unsigned int index;
|
||||
|
||||
table = net->mpls.ctl->ctl_table_arg;
|
||||
|
@ -198,7 +198,7 @@ err_alloc:
|
||||
|
||||
static void mptcp_pernet_del_table(struct mptcp_pernet *pernet)
|
||||
{
|
||||
struct ctl_table *table = pernet->ctl_table_hdr->ctl_table_arg;
|
||||
const struct ctl_table *table = pernet->ctl_table_hdr->ctl_table_arg;
|
||||
|
||||
unregister_net_sysctl_table(pernet->ctl_table_hdr);
|
||||
|
||||
|
@ -1122,7 +1122,7 @@ out_unregister_netfilter:
|
||||
static void nf_conntrack_standalone_fini_sysctl(struct net *net)
|
||||
{
|
||||
struct nf_conntrack_net *cnet = nf_ct_pernet(net);
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = cnet->sysctl_header->ctl_table_arg;
|
||||
unregister_net_sysctl_table(cnet->sysctl_header);
|
||||
|
@ -514,7 +514,7 @@ err_alloc:
|
||||
|
||||
static void netfilter_log_sysctl_exit(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = net->nf.nf_log_dir_header->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->nf.nf_log_dir_header);
|
||||
|
@ -624,7 +624,7 @@ int sctp_sysctl_net_register(struct net *net)
|
||||
|
||||
void sctp_sysctl_net_unregister(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = net->sctp.sysctl_header->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->sctp.sysctl_header);
|
||||
|
@ -133,7 +133,7 @@ err_alloc:
|
||||
|
||||
void __net_exit smc_sysctl_net_exit(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = net->smc.smc_hdr->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->smc.smc_hdr);
|
||||
|
@ -52,7 +52,7 @@ err_alloc:
|
||||
|
||||
void unix_sysctl_unregister(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = net->unx.ctl->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->unx.ctl);
|
||||
|
@ -76,7 +76,7 @@ out_kmemdup:
|
||||
|
||||
void __net_exit xfrm_sysctl_fini(struct net *net)
|
||||
{
|
||||
struct ctl_table *table;
|
||||
const struct ctl_table *table;
|
||||
|
||||
table = net->xfrm.sysctl_hdr->ctl_table_arg;
|
||||
unregister_net_sysctl_table(net->xfrm.sysctl_hdr);
|
||||
|
Loading…
Reference in New Issue
Block a user