diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index d580df2e6804..385f7817bfcc 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -196,6 +196,7 @@ recopy: | |||
196 | goto error; | 196 | goto error; |
197 | 197 | ||
198 | result->uptr = filename; | 198 | result->uptr = filename; |
199 | result->aname = NULL; | ||
199 | audit_getname(result); | 200 | audit_getname(result); |
200 | return result; | 201 | return result; |
201 | 202 | ||
@@ -210,6 +211,35 @@ getname(const char __user * filename) | |||
210 | return getname_flags(filename, 0, NULL); | 211 | return getname_flags(filename, 0, NULL); |
211 | } | 212 | } |
212 | 213 | ||
214 | /* | ||
215 | * The "getname_kernel()" interface doesn't do pathnames longer | ||
216 | * than EMBEDDED_NAME_MAX. Deal with it - you're a kernel user. | ||
217 | */ | ||
218 | struct filename * | ||
219 | getname_kernel(const char * filename) | ||
220 | { | ||
221 | struct filename *result; | ||
222 | char *kname; | ||
223 | int len; | ||
224 | |||
225 | len = strlen(filename); | ||
226 | if (len >= EMBEDDED_NAME_MAX) | ||
227 | return ERR_PTR(-ENAMETOOLONG); | ||
228 | |||
229 | result = __getname(); | ||
230 | if (unlikely(!result)) | ||
231 | return ERR_PTR(-ENOMEM); | ||
232 | |||
233 | kname = (char *)result + sizeof(*result); | ||
234 | result->name = kname; | ||
235 | result->uptr = NULL; | ||
236 | result->aname = NULL; | ||
237 | result->separate = false; | ||
238 | |||
239 | strlcpy(kname, filename, EMBEDDED_NAME_MAX); | ||
240 | return result; | ||
241 | } | ||
242 | |||
213 | #ifdef CONFIG_AUDITSYSCALL | 243 | #ifdef CONFIG_AUDITSYSCALL |
214 | void putname(struct filename *name) | 244 | void putname(struct filename *name) |
215 | { | 245 | { |