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