diff options
-rw-r--r-- | fs/autofs4/waitq.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index 689e40d983ad..116fd38ee472 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
@@ -347,11 +347,23 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
347 | struct qstr qstr; | 347 | struct qstr qstr; |
348 | char *name; | 348 | char *name; |
349 | int status, ret, type; | 349 | int status, ret, type; |
350 | pid_t pid; | ||
351 | pid_t tgid; | ||
350 | 352 | ||
351 | /* In catatonic mode, we don't wait for nobody */ | 353 | /* In catatonic mode, we don't wait for nobody */ |
352 | if (sbi->catatonic) | 354 | if (sbi->catatonic) |
353 | return -ENOENT; | 355 | return -ENOENT; |
354 | 356 | ||
357 | /* | ||
358 | * Try translating pids to the namespace of the daemon. | ||
359 | * | ||
360 | * Zero means failure: we are in an unrelated pid namespace. | ||
361 | */ | ||
362 | pid = task_pid_nr_ns(current, ns_of_pid(sbi->oz_pgrp)); | ||
363 | tgid = task_tgid_nr_ns(current, ns_of_pid(sbi->oz_pgrp)); | ||
364 | if (pid == 0 || tgid == 0) | ||
365 | return -ENOENT; | ||
366 | |||
355 | if (!dentry->d_inode) { | 367 | if (!dentry->d_inode) { |
356 | /* | 368 | /* |
357 | * A wait for a negative dentry is invalid for certain | 369 | * A wait for a negative dentry is invalid for certain |
@@ -417,8 +429,8 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry, | |||
417 | wq->ino = autofs4_get_ino(sbi); | 429 | wq->ino = autofs4_get_ino(sbi); |
418 | wq->uid = current_uid(); | 430 | wq->uid = current_uid(); |
419 | wq->gid = current_gid(); | 431 | wq->gid = current_gid(); |
420 | wq->pid = current->pid; | 432 | wq->pid = pid; |
421 | wq->tgid = current->tgid; | 433 | wq->tgid = tgid; |
422 | wq->status = -EINTR; /* Status return if interrupted */ | 434 | wq->status = -EINTR; /* Status return if interrupted */ |
423 | wq->wait_ctr = 2; | 435 | wq->wait_ctr = 2; |
424 | 436 | ||