@@ -122,21 +122,11 @@ static void loadpin_sb_free_security(struct super_block *mnt_sb)
122
122
}
123
123
}
124
124
125
- static int loadpin_read_file (struct file * file , enum kernel_read_file_id id ,
126
- bool contents )
125
+ static int loadpin_check (struct file * file , enum kernel_read_file_id id )
127
126
{
128
127
struct super_block * load_root ;
129
128
const char * origin = kernel_read_file_id_str (id );
130
129
131
- /*
132
- * If we will not know that we'll be seeing the full contents
133
- * then we cannot trust a load will be complete and unchanged
134
- * off disk. Treat all contents=false hooks as if there were
135
- * no associated file struct.
136
- */
137
- if (!contents )
138
- file = NULL ;
139
-
140
130
/* If the file id is excluded, ignore the pinning. */
141
131
if ((unsigned int )id < ARRAY_SIZE (ignore_read_file_id ) &&
142
132
ignore_read_file_id [id ]) {
@@ -192,9 +182,25 @@ static int loadpin_read_file(struct file *file, enum kernel_read_file_id id,
192
182
return 0 ;
193
183
}
194
184
185
+ static int loadpin_read_file (struct file * file , enum kernel_read_file_id id ,
186
+ bool contents )
187
+ {
188
+ /*
189
+ * LoadPin only cares about the _origin_ of a file, not its
190
+ * contents, so we can ignore the "are full contents available"
191
+ * argument here.
192
+ */
193
+ return loadpin_check (file , id );
194
+ }
195
+
195
196
static int loadpin_load_data (enum kernel_load_data_id id , bool contents )
196
197
{
197
- return loadpin_read_file (NULL , (enum kernel_read_file_id ) id , contents );
198
+ /*
199
+ * LoadPin only cares about the _origin_ of a file, not its
200
+ * contents, so a NULL file is passed, and we can ignore the
201
+ * state of "contents".
202
+ */
203
+ return loadpin_check (NULL , (enum kernel_read_file_id ) id );
198
204
}
199
205
200
206
static struct security_hook_list loadpin_hooks [] __lsm_ro_after_init = {
0 commit comments