Skip to content

Commit

Permalink
net: delete /proc THIS_MODULE references
Browse files Browse the repository at this point in the history
/proc has been ignoring struct file_operations::owner field for 10 years.
Specifically, it started with commit 786d7e1
("Fix rmmod/read/write races in /proc entries"). Notice the chunk where
inode->i_fop is initialized with proxy struct file_operations for
regular files:

	-               if (de->proc_fops)
	-                       inode->i_fop = de->proc_fops;
	+               if (de->proc_fops) {
	+                       if (S_ISREG(inode->i_mode))
	+                               inode->i_fop = &proc_reg_file_ops;
	+                       else
	+                               inode->i_fop = de->proc_fops;
	+               }

VFS stopped pinning module at this point.

Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and davem330 committed Jan 16, 2018
1 parent 868717a commit 96890d6
Show file tree
Hide file tree
Showing 61 changed files with 0 additions and 96 deletions.
2 changes: 0 additions & 2 deletions net/8021q/vlanproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ static int vlan_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations vlan_fops = {
.owner = THIS_MODULE,
.open = vlan_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand All @@ -97,7 +96,6 @@ static int vlandev_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations vlandev_fops = {
.owner = THIS_MODULE,
.open = vlandev_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/appletalk/aarp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,6 @@ static int aarp_seq_open(struct inode *inode, struct file *file)
}

const struct file_operations atalk_seq_arp_fops = {
.owner = THIS_MODULE,
.open = aarp_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
3 changes: 0 additions & 3 deletions net/appletalk/atalk_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,23 +226,20 @@ static int atalk_seq_socket_open(struct inode *inode, struct file *file)
}

static const struct file_operations atalk_seq_interface_fops = {
.owner = THIS_MODULE,
.open = atalk_seq_interface_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};

static const struct file_operations atalk_seq_route_fops = {
.owner = THIS_MODULE,
.open = atalk_seq_route_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};

static const struct file_operations atalk_seq_socket_fops = {
.owner = THIS_MODULE,
.open = atalk_seq_socket_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/atm/br2684.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,6 @@ static int br2684_proc_open(struct inode *inode, struct file *file)
}

static const struct file_operations br2684_proc_ops = {
.owner = THIS_MODULE,
.open = br2684_proc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/atm/lec.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@ static int lec_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations lec_seq_fops = {
.owner = THIS_MODULE,
.open = lec_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/atm/mpoa_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ static int parse_qos(const char *buff);
* Define allowed FILE OPERATIONS
*/
static const struct file_operations mpc_file_operations = {
.owner = THIS_MODULE,
.open = proc_mpc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/atm/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ static ssize_t proc_dev_atm_read(struct file *file, char __user *buf,
size_t count, loff_t *pos);

static const struct file_operations proc_atm_dev_ops = {
.owner = THIS_MODULE,
.read = proc_dev_atm_read,
.llseek = noop_llseek,
};
Expand Down
1 change: 0 additions & 1 deletion net/ax25/af_ax25.c
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,6 @@ static int ax25_info_open(struct inode *inode, struct file *file)
}

static const struct file_operations ax25_info_fops = {
.owner = THIS_MODULE,
.open = ax25_info_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/ax25/ax25_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ static int ax25_rt_info_open(struct inode *inode, struct file *file)
}

const struct file_operations ax25_route_fops = {
.owner = THIS_MODULE,
.open = ax25_rt_info_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/ax25/ax25_uid.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ static int ax25_uid_info_open(struct inode *inode, struct file *file)
}

const struct file_operations ax25_uid_fops = {
.owner = THIS_MODULE,
.open = ax25_uid_info_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/bluetooth/cmtp/capi.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ static int cmtp_proc_open(struct inode *inode, struct file *file)
}

static const struct file_operations cmtp_proc_fops = {
.owner = THIS_MODULE,
.open = cmtp_proc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/can/bcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ static int bcm_proc_open(struct inode *inode, struct file *file)
}

static const struct file_operations bcm_proc_fops = {
.owner = THIS_MODULE,
.open = bcm_proc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
6 changes: 0 additions & 6 deletions net/can/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ static int can_stats_proc_open(struct inode *inode, struct file *file)
}

static const struct file_operations can_stats_proc_fops = {
.owner = THIS_MODULE,
.open = can_stats_proc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -310,7 +309,6 @@ static int can_reset_stats_proc_open(struct inode *inode, struct file *file)
}

static const struct file_operations can_reset_stats_proc_fops = {
.owner = THIS_MODULE,
.open = can_reset_stats_proc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand All @@ -329,7 +327,6 @@ static int can_version_proc_open(struct inode *inode, struct file *file)
}

static const struct file_operations can_version_proc_fops = {
.owner = THIS_MODULE,
.open = can_version_proc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -382,7 +379,6 @@ static int can_rcvlist_proc_open(struct inode *inode, struct file *file)
}

static const struct file_operations can_rcvlist_proc_fops = {
.owner = THIS_MODULE,
.open = can_rcvlist_proc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -450,7 +446,6 @@ static int can_rcvlist_sff_proc_open(struct inode *inode, struct file *file)
}

static const struct file_operations can_rcvlist_sff_proc_fops = {
.owner = THIS_MODULE,
.open = can_rcvlist_sff_proc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -494,7 +489,6 @@ static int can_rcvlist_eff_proc_open(struct inode *inode, struct file *file)
}

static const struct file_operations can_rcvlist_eff_proc_fops = {
.owner = THIS_MODULE,
.open = can_rcvlist_eff_proc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -2862,7 +2862,6 @@ static int neigh_stat_seq_open(struct inode *inode, struct file *file)
};

static const struct file_operations neigh_stat_seq_fops = {
.owner = THIS_MODULE,
.open = neigh_stat_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
4 changes: 0 additions & 4 deletions net/core/net-procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ static int dev_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations dev_seq_fops = {
.owner = THIS_MODULE,
.open = dev_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand All @@ -202,7 +201,6 @@ static int softnet_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations softnet_seq_fops = {
.owner = THIS_MODULE,
.open = softnet_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -306,7 +304,6 @@ static int ptype_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations ptype_seq_fops = {
.owner = THIS_MODULE,
.open = ptype_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -387,7 +384,6 @@ static int dev_mc_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations dev_mc_seq_fops = {
.owner = THIS_MODULE,
.open = dev_mc_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
3 changes: 0 additions & 3 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ static int pgctrl_open(struct inode *inode, struct file *file)
}

static const struct file_operations pktgen_fops = {
.owner = THIS_MODULE,
.open = pgctrl_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -1804,7 +1803,6 @@ static int pktgen_if_open(struct inode *inode, struct file *file)
}

static const struct file_operations pktgen_if_fops = {
.owner = THIS_MODULE,
.open = pktgen_if_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -1942,7 +1940,6 @@ static int pktgen_thread_open(struct inode *inode, struct file *file)
}

static const struct file_operations pktgen_thread_fops = {
.owner = THIS_MODULE,
.open = pktgen_thread_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -3362,7 +3362,6 @@ static int proto_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations proto_seq_fops = {
.owner = THIS_MODULE,
.open = proto_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/decnet/af_decnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,6 @@ static int dn_socket_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations dn_socket_seq_fops = {
.owner = THIS_MODULE,
.open = dn_socket_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,6 @@ static int dn_dev_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations dn_dev_seq_fops = {
.owner = THIS_MODULE,
.open = dn_dev_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/decnet/dn_neigh.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,6 @@ static int dn_neigh_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations dn_neigh_seq_fops = {
.owner = THIS_MODULE,
.open = dn_neigh_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/decnet/dn_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,6 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations dn_rt_cache_seq_fops = {
.owner = THIS_MODULE,
.open = dn_rt_cache_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,6 @@ static int arp_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations arp_seq_fops = {
.owner = THIS_MODULE,
.open = arp_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
3 changes: 0 additions & 3 deletions net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -2334,7 +2334,6 @@ static int fib_triestat_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations fib_triestat_fops = {
.owner = THIS_MODULE,
.open = fib_triestat_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -2521,7 +2520,6 @@ static int fib_trie_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations fib_trie_fops = {
.owner = THIS_MODULE,
.open = fib_trie_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -2715,7 +2713,6 @@ static int fib_route_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations fib_route_fops = {
.owner = THIS_MODULE,
.open = fib_route_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
2 changes: 0 additions & 2 deletions net/ipv4/igmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2832,7 +2832,6 @@ static int igmp_mc_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations igmp_mc_seq_fops = {
.owner = THIS_MODULE,
.open = igmp_mc_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -2979,7 +2978,6 @@ static int igmp_mcf_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations igmp_mcf_seq_fops = {
.owner = THIS_MODULE,
.open = igmp_mcf_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/ipconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,6 @@ static int pnp_seq_open(struct inode *indoe, struct file *file)
}

static const struct file_operations pnp_seq_fops = {
.owner = THIS_MODULE,
.open = pnp_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
2 changes: 0 additions & 2 deletions net/ipv4/ipmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,6 @@ static int ipmr_vif_open(struct inode *inode, struct file *file)
}

static const struct file_operations ipmr_vif_fops = {
.owner = THIS_MODULE,
.open = ipmr_vif_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -3198,7 +3197,6 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file)
}

static const struct file_operations ipmr_mfc_fops = {
.owner = THIS_MODULE,
.open = ipmr_mfc_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/netfilter/ipt_CLUSTERIP.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ static ssize_t clusterip_proc_write(struct file *file, const char __user *input,
}

static const struct file_operations clusterip_proc_fops = {
.owner = THIS_MODULE,
.open = clusterip_proc_open,
.read = seq_read,
.write = clusterip_proc_write,
Expand Down
3 changes: 0 additions & 3 deletions net/ipv4/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ static int sockstat_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations sockstat_seq_fops = {
.owner = THIS_MODULE,
.open = sockstat_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -467,7 +466,6 @@ static int snmp_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations snmp_seq_fops = {
.owner = THIS_MODULE,
.open = snmp_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down Expand Up @@ -515,7 +513,6 @@ static int netstat_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations netstat_seq_fops = {
.owner = THIS_MODULE,
.open = netstat_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
1 change: 0 additions & 1 deletion net/ipv4/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,6 @@ static int raw_v4_seq_open(struct inode *inode, struct file *file)
}

static const struct file_operations raw_seq_fops = {
.owner = THIS_MODULE,
.open = raw_v4_seq_open,
.read = seq_read,
.llseek = seq_lseek,
Expand Down
Loading

0 comments on commit 96890d6

Please sign in to comment.