Skip to content

Commit 96890d6

Browse files
Alexey Dobriyandavem330
authored andcommitted
net: delete /proc THIS_MODULE references
/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]>
1 parent 868717a commit 96890d6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+0
-96
lines changed

net/8021q/vlanproc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ static int vlan_seq_open(struct inode *inode, struct file *file)
8080
}
8181

8282
static const struct file_operations vlan_fops = {
83-
.owner = THIS_MODULE,
8483
.open = vlan_seq_open,
8584
.read = seq_read,
8685
.llseek = seq_lseek,
@@ -97,7 +96,6 @@ static int vlandev_seq_open(struct inode *inode, struct file *file)
9796
}
9897

9998
static const struct file_operations vlandev_fops = {
100-
.owner = THIS_MODULE,
10199
.open = vlandev_seq_open,
102100
.read = seq_read,
103101
.llseek = seq_lseek,

net/appletalk/aarp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,6 @@ static int aarp_seq_open(struct inode *inode, struct file *file)
10471047
}
10481048

10491049
const struct file_operations atalk_seq_arp_fops = {
1050-
.owner = THIS_MODULE,
10511050
.open = aarp_seq_open,
10521051
.read = seq_read,
10531052
.llseek = seq_lseek,

net/appletalk/atalk_proc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,23 +226,20 @@ static int atalk_seq_socket_open(struct inode *inode, struct file *file)
226226
}
227227

228228
static const struct file_operations atalk_seq_interface_fops = {
229-
.owner = THIS_MODULE,
230229
.open = atalk_seq_interface_open,
231230
.read = seq_read,
232231
.llseek = seq_lseek,
233232
.release = seq_release,
234233
};
235234

236235
static const struct file_operations atalk_seq_route_fops = {
237-
.owner = THIS_MODULE,
238236
.open = atalk_seq_route_open,
239237
.read = seq_read,
240238
.llseek = seq_lseek,
241239
.release = seq_release,
242240
};
243241

244242
static const struct file_operations atalk_seq_socket_fops = {
245-
.owner = THIS_MODULE,
246243
.open = atalk_seq_socket_open,
247244
.read = seq_read,
248245
.llseek = seq_lseek,

net/atm/br2684.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,6 @@ static int br2684_proc_open(struct inode *inode, struct file *file)
824824
}
825825

826826
static const struct file_operations br2684_proc_ops = {
827-
.owner = THIS_MODULE,
828827
.open = br2684_proc_open,
829828
.read = seq_read,
830829
.llseek = seq_lseek,

net/atm/lec.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,6 @@ static int lec_seq_open(struct inode *inode, struct file *file)
992992
}
993993

994994
static const struct file_operations lec_seq_fops = {
995-
.owner = THIS_MODULE,
996995
.open = lec_seq_open,
997996
.read = seq_read,
998997
.llseek = seq_lseek,

net/atm/mpoa_proc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ static int parse_qos(const char *buff);
5757
* Define allowed FILE OPERATIONS
5858
*/
5959
static const struct file_operations mpc_file_operations = {
60-
.owner = THIS_MODULE,
6160
.open = proc_mpc_open,
6261
.read = seq_read,
6362
.llseek = seq_lseek,

net/atm/proc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ static ssize_t proc_dev_atm_read(struct file *file, char __user *buf,
3737
size_t count, loff_t *pos);
3838

3939
static const struct file_operations proc_atm_dev_ops = {
40-
.owner = THIS_MODULE,
4140
.read = proc_dev_atm_read,
4241
.llseek = noop_llseek,
4342
};

net/ax25/af_ax25.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1931,7 +1931,6 @@ static int ax25_info_open(struct inode *inode, struct file *file)
19311931
}
19321932

19331933
static const struct file_operations ax25_info_fops = {
1934-
.owner = THIS_MODULE,
19351934
.open = ax25_info_open,
19361935
.read = seq_read,
19371936
.llseek = seq_lseek,

net/ax25/ax25_route.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ static int ax25_rt_info_open(struct inode *inode, struct file *file)
336336
}
337337

338338
const struct file_operations ax25_route_fops = {
339-
.owner = THIS_MODULE,
340339
.open = ax25_rt_info_open,
341340
.read = seq_read,
342341
.llseek = seq_lseek,

net/ax25/ax25_uid.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ static int ax25_uid_info_open(struct inode *inode, struct file *file)
194194
}
195195

196196
const struct file_operations ax25_uid_fops = {
197-
.owner = THIS_MODULE,
198197
.open = ax25_uid_info_open,
199198
.read = seq_read,
200199
.llseek = seq_lseek,

net/bluetooth/cmtp/capi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,6 @@ static int cmtp_proc_open(struct inode *inode, struct file *file)
527527
}
528528

529529
static const struct file_operations cmtp_proc_fops = {
530-
.owner = THIS_MODULE,
531530
.open = cmtp_proc_open,
532531
.read = seq_read,
533532
.llseek = seq_lseek,

net/can/bcm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ static int bcm_proc_open(struct inode *inode, struct file *file)
246246
}
247247

248248
static const struct file_operations bcm_proc_fops = {
249-
.owner = THIS_MODULE,
250249
.open = bcm_proc_open,
251250
.read = seq_read,
252251
.llseek = seq_lseek,

net/can/proc.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@ static int can_stats_proc_open(struct inode *inode, struct file *file)
276276
}
277277

278278
static const struct file_operations can_stats_proc_fops = {
279-
.owner = THIS_MODULE,
280279
.open = can_stats_proc_open,
281280
.read = seq_read,
282281
.llseek = seq_lseek,
@@ -310,7 +309,6 @@ static int can_reset_stats_proc_open(struct inode *inode, struct file *file)
310309
}
311310

312311
static const struct file_operations can_reset_stats_proc_fops = {
313-
.owner = THIS_MODULE,
314312
.open = can_reset_stats_proc_open,
315313
.read = seq_read,
316314
.llseek = seq_lseek,
@@ -329,7 +327,6 @@ static int can_version_proc_open(struct inode *inode, struct file *file)
329327
}
330328

331329
static const struct file_operations can_version_proc_fops = {
332-
.owner = THIS_MODULE,
333330
.open = can_version_proc_open,
334331
.read = seq_read,
335332
.llseek = seq_lseek,
@@ -382,7 +379,6 @@ static int can_rcvlist_proc_open(struct inode *inode, struct file *file)
382379
}
383380

384381
static const struct file_operations can_rcvlist_proc_fops = {
385-
.owner = THIS_MODULE,
386382
.open = can_rcvlist_proc_open,
387383
.read = seq_read,
388384
.llseek = seq_lseek,
@@ -450,7 +446,6 @@ static int can_rcvlist_sff_proc_open(struct inode *inode, struct file *file)
450446
}
451447

452448
static const struct file_operations can_rcvlist_sff_proc_fops = {
453-
.owner = THIS_MODULE,
454449
.open = can_rcvlist_sff_proc_open,
455450
.read = seq_read,
456451
.llseek = seq_lseek,
@@ -494,7 +489,6 @@ static int can_rcvlist_eff_proc_open(struct inode *inode, struct file *file)
494489
}
495490

496491
static const struct file_operations can_rcvlist_eff_proc_fops = {
497-
.owner = THIS_MODULE,
498492
.open = can_rcvlist_eff_proc_open,
499493
.read = seq_read,
500494
.llseek = seq_lseek,

net/core/neighbour.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2862,7 +2862,6 @@ static int neigh_stat_seq_open(struct inode *inode, struct file *file)
28622862
};
28632863

28642864
static const struct file_operations neigh_stat_seq_fops = {
2865-
.owner = THIS_MODULE,
28662865
.open = neigh_stat_seq_open,
28672866
.read = seq_read,
28682867
.llseek = seq_lseek,

net/core/net-procfs.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ static int dev_seq_open(struct inode *inode, struct file *file)
182182
}
183183

184184
static const struct file_operations dev_seq_fops = {
185-
.owner = THIS_MODULE,
186185
.open = dev_seq_open,
187186
.read = seq_read,
188187
.llseek = seq_lseek,
@@ -202,7 +201,6 @@ static int softnet_seq_open(struct inode *inode, struct file *file)
202201
}
203202

204203
static const struct file_operations softnet_seq_fops = {
205-
.owner = THIS_MODULE,
206204
.open = softnet_seq_open,
207205
.read = seq_read,
208206
.llseek = seq_lseek,
@@ -306,7 +304,6 @@ static int ptype_seq_open(struct inode *inode, struct file *file)
306304
}
307305

308306
static const struct file_operations ptype_seq_fops = {
309-
.owner = THIS_MODULE,
310307
.open = ptype_seq_open,
311308
.read = seq_read,
312309
.llseek = seq_lseek,
@@ -387,7 +384,6 @@ static int dev_mc_seq_open(struct inode *inode, struct file *file)
387384
}
388385

389386
static const struct file_operations dev_mc_seq_fops = {
390-
.owner = THIS_MODULE,
391387
.open = dev_mc_seq_open,
392388
.read = seq_read,
393389
.llseek = seq_lseek,

net/core/pktgen.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,6 @@ static int pgctrl_open(struct inode *inode, struct file *file)
523523
}
524524

525525
static const struct file_operations pktgen_fops = {
526-
.owner = THIS_MODULE,
527526
.open = pgctrl_open,
528527
.read = seq_read,
529528
.llseek = seq_lseek,
@@ -1804,7 +1803,6 @@ static int pktgen_if_open(struct inode *inode, struct file *file)
18041803
}
18051804

18061805
static const struct file_operations pktgen_if_fops = {
1807-
.owner = THIS_MODULE,
18081806
.open = pktgen_if_open,
18091807
.read = seq_read,
18101808
.llseek = seq_lseek,
@@ -1942,7 +1940,6 @@ static int pktgen_thread_open(struct inode *inode, struct file *file)
19421940
}
19431941

19441942
static const struct file_operations pktgen_thread_fops = {
1945-
.owner = THIS_MODULE,
19461943
.open = pktgen_thread_open,
19471944
.read = seq_read,
19481945
.llseek = seq_lseek,

net/core/sock.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3362,7 +3362,6 @@ static int proto_seq_open(struct inode *inode, struct file *file)
33623362
}
33633363

33643364
static const struct file_operations proto_seq_fops = {
3365-
.owner = THIS_MODULE,
33663365
.open = proto_seq_open,
33673366
.read = seq_read,
33683367
.llseek = seq_lseek,

net/decnet/af_decnet.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2320,7 +2320,6 @@ static int dn_socket_seq_open(struct inode *inode, struct file *file)
23202320
}
23212321

23222322
static const struct file_operations dn_socket_seq_fops = {
2323-
.owner = THIS_MODULE,
23242323
.open = dn_socket_seq_open,
23252324
.read = seq_read,
23262325
.llseek = seq_lseek,

net/decnet/dn_dev.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,6 @@ static int dn_dev_seq_open(struct inode *inode, struct file *file)
13891389
}
13901390

13911391
static const struct file_operations dn_dev_seq_fops = {
1392-
.owner = THIS_MODULE,
13931392
.open = dn_dev_seq_open,
13941393
.read = seq_read,
13951394
.llseek = seq_lseek,

net/decnet/dn_neigh.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,6 @@ static int dn_neigh_seq_open(struct inode *inode, struct file *file)
597597
}
598598

599599
static const struct file_operations dn_neigh_seq_fops = {
600-
.owner = THIS_MODULE,
601600
.open = dn_neigh_seq_open,
602601
.read = seq_read,
603602
.llseek = seq_lseek,

net/decnet/dn_route.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,6 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file)
18601860
}
18611861

18621862
static const struct file_operations dn_rt_cache_seq_fops = {
1863-
.owner = THIS_MODULE,
18641863
.open = dn_rt_cache_seq_open,
18651864
.read = seq_read,
18661865
.llseek = seq_lseek,

net/ipv4/arp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,6 @@ static int arp_seq_open(struct inode *inode, struct file *file)
14201420
}
14211421

14221422
static const struct file_operations arp_seq_fops = {
1423-
.owner = THIS_MODULE,
14241423
.open = arp_seq_open,
14251424
.read = seq_read,
14261425
.llseek = seq_lseek,

net/ipv4/fib_trie.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,7 +2334,6 @@ static int fib_triestat_seq_open(struct inode *inode, struct file *file)
23342334
}
23352335

23362336
static const struct file_operations fib_triestat_fops = {
2337-
.owner = THIS_MODULE,
23382337
.open = fib_triestat_seq_open,
23392338
.read = seq_read,
23402339
.llseek = seq_lseek,
@@ -2521,7 +2520,6 @@ static int fib_trie_seq_open(struct inode *inode, struct file *file)
25212520
}
25222521

25232522
static const struct file_operations fib_trie_fops = {
2524-
.owner = THIS_MODULE,
25252523
.open = fib_trie_seq_open,
25262524
.read = seq_read,
25272525
.llseek = seq_lseek,
@@ -2715,7 +2713,6 @@ static int fib_route_seq_open(struct inode *inode, struct file *file)
27152713
}
27162714

27172715
static const struct file_operations fib_route_fops = {
2718-
.owner = THIS_MODULE,
27192716
.open = fib_route_seq_open,
27202717
.read = seq_read,
27212718
.llseek = seq_lseek,

net/ipv4/igmp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2832,7 +2832,6 @@ static int igmp_mc_seq_open(struct inode *inode, struct file *file)
28322832
}
28332833

28342834
static const struct file_operations igmp_mc_seq_fops = {
2835-
.owner = THIS_MODULE,
28362835
.open = igmp_mc_seq_open,
28372836
.read = seq_read,
28382837
.llseek = seq_lseek,
@@ -2979,7 +2978,6 @@ static int igmp_mcf_seq_open(struct inode *inode, struct file *file)
29792978
}
29802979

29812980
static const struct file_operations igmp_mcf_seq_fops = {
2982-
.owner = THIS_MODULE,
29832981
.open = igmp_mcf_seq_open,
29842982
.read = seq_read,
29852983
.llseek = seq_lseek,

net/ipv4/ipconfig.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,6 @@ static int pnp_seq_open(struct inode *indoe, struct file *file)
13221322
}
13231323

13241324
static const struct file_operations pnp_seq_fops = {
1325-
.owner = THIS_MODULE,
13261325
.open = pnp_seq_open,
13271326
.read = seq_read,
13281327
.llseek = seq_lseek,

net/ipv4/ipmr.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,7 +3045,6 @@ static int ipmr_vif_open(struct inode *inode, struct file *file)
30453045
}
30463046

30473047
static const struct file_operations ipmr_vif_fops = {
3048-
.owner = THIS_MODULE,
30493048
.open = ipmr_vif_open,
30503049
.read = seq_read,
30513050
.llseek = seq_lseek,
@@ -3198,7 +3197,6 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file)
31983197
}
31993198

32003199
static const struct file_operations ipmr_mfc_fops = {
3201-
.owner = THIS_MODULE,
32023200
.open = ipmr_mfc_open,
32033201
.read = seq_read,
32043202
.llseek = seq_lseek,

net/ipv4/netfilter/ipt_CLUSTERIP.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ static ssize_t clusterip_proc_write(struct file *file, const char __user *input,
776776
}
777777

778778
static const struct file_operations clusterip_proc_fops = {
779-
.owner = THIS_MODULE,
780779
.open = clusterip_proc_open,
781780
.read = seq_read,
782781
.write = clusterip_proc_write,

net/ipv4/proc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ static int sockstat_seq_open(struct inode *inode, struct file *file)
8383
}
8484

8585
static const struct file_operations sockstat_seq_fops = {
86-
.owner = THIS_MODULE,
8786
.open = sockstat_seq_open,
8887
.read = seq_read,
8988
.llseek = seq_lseek,
@@ -467,7 +466,6 @@ static int snmp_seq_open(struct inode *inode, struct file *file)
467466
}
468467

469468
static const struct file_operations snmp_seq_fops = {
470-
.owner = THIS_MODULE,
471469
.open = snmp_seq_open,
472470
.read = seq_read,
473471
.llseek = seq_lseek,
@@ -515,7 +513,6 @@ static int netstat_seq_open(struct inode *inode, struct file *file)
515513
}
516514

517515
static const struct file_operations netstat_seq_fops = {
518-
.owner = THIS_MODULE,
519516
.open = netstat_seq_open,
520517
.read = seq_read,
521518
.llseek = seq_lseek,

net/ipv4/raw.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,6 @@ static int raw_v4_seq_open(struct inode *inode, struct file *file)
11191119
}
11201120

11211121
static const struct file_operations raw_seq_fops = {
1122-
.owner = THIS_MODULE,
11231122
.open = raw_v4_seq_open,
11241123
.read = seq_read,
11251124
.llseek = seq_lseek,

0 commit comments

Comments
 (0)