@@ -72,7 +72,7 @@ static int seq_show(struct seq_file *m, void *v)
72
72
return 0 ;
73
73
}
74
74
75
- static int seq_fdinfo_open (struct inode * inode , struct file * file )
75
+ static int proc_fdinfo_access_allowed (struct inode * inode )
76
76
{
77
77
bool allowed = false;
78
78
struct task_struct * task = get_proc_task (inode );
@@ -86,6 +86,16 @@ static int seq_fdinfo_open(struct inode *inode, struct file *file)
86
86
if (!allowed )
87
87
return - EACCES ;
88
88
89
+ return 0 ;
90
+ }
91
+
92
+ static int seq_fdinfo_open (struct inode * inode , struct file * file )
93
+ {
94
+ int ret = proc_fdinfo_access_allowed (inode );
95
+
96
+ if (ret )
97
+ return ret ;
98
+
89
99
return single_open (file , seq_show , inode );
90
100
}
91
101
@@ -348,12 +358,23 @@ static int proc_readfdinfo(struct file *file, struct dir_context *ctx)
348
358
proc_fdinfo_instantiate );
349
359
}
350
360
361
+ static int proc_open_fdinfo (struct inode * inode , struct file * file )
362
+ {
363
+ int ret = proc_fdinfo_access_allowed (inode );
364
+
365
+ if (ret )
366
+ return ret ;
367
+
368
+ return 0 ;
369
+ }
370
+
351
371
const struct inode_operations proc_fdinfo_inode_operations = {
352
372
.lookup = proc_lookupfdinfo ,
353
373
.setattr = proc_setattr ,
354
374
};
355
375
356
376
const struct file_operations proc_fdinfo_operations = {
377
+ .open = proc_open_fdinfo ,
357
378
.read = generic_read_dir ,
358
379
.iterate_shared = proc_readfdinfo ,
359
380
.llseek = generic_file_llseek ,
0 commit comments