From: Miklos Szeredi <miklos@szeredi.hu>
To: raven@themaw.net
Cc: autofs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, sukadev@linux.vnet.ibm.com,
serge.hallyn@canonical.com, ebiederm@xmission.com,
mszeredi@suse.cz
Subject: [PATCH 2/2] autofs4: store struct pids in autofs_waitqs
Date: Wed, 19 Sep 2012 17:29:36 +0200 [thread overview]
Message-ID: <1348068576-21363-3-git-send-email-miklos@szeredi.hu> (raw)
In-Reply-To: <1348068576-21363-1-git-send-email-miklos@szeredi.hu>
From: Serge Hallyn <serue@us.ibm.com>
Store struct pids in autofs_waitqs in place of pidnrs to prevent
pid overflow problems.
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Cc: Eric Biederman <ebiederm@xmission.com>
---
fs/autofs4/autofs_i.h | 4 ++--
fs/autofs4/waitq.c | 19 +++++++++++++------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 8457a1f..c3b3302 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -91,8 +91,8 @@ struct autofs_wait_queue {
u64 ino;
uid_t uid;
gid_t gid;
- pid_t pid;
- pid_t tgid;
+ struct pid *pid;
+ struct pid *tgid;
/* This is for status reporting upon return */
int status;
unsigned int wait_ctr;
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index da8876d..27b18ae 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -165,8 +165,8 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
packet->ino = wq->ino;
packet->uid = wq->uid;
packet->gid = wq->gid;
- packet->pid = wq->pid;
- packet->tgid = wq->tgid;
+ packet->pid = pid_nr(wq->pid);
+ packet->tgid = pid_nr(wq->tgid);
break;
}
default:
@@ -348,6 +348,13 @@ static int validate_request(struct autofs_wait_queue **wait,
return 1;
}
+static void autofs_free_wait_queue(struct autofs_wait_queue *wq)
+{
+ put_pid(wq->pid);
+ put_pid(wq->tgid);
+ kfree(wq);
+}
+
int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
enum autofs_notify notify)
{
@@ -425,8 +432,8 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
wq->ino = autofs4_get_ino(sbi);
wq->uid = current_uid();
wq->gid = current_gid();
- wq->pid = current->pid;
- wq->tgid = current->tgid;
+ wq->pid = get_pid(task_pid(current));
+ wq->tgid = get_pid(task_tgid(current));
wq->status = -EINTR; /* Status return if interrupted */
wq->wait_ctr = 2;
mutex_unlock(&sbi->wq_mutex);
@@ -526,7 +533,7 @@ int autofs4_wait(struct autofs_sb_info *sbi, struct dentry *dentry,
/* Are we the last process to need status? */
mutex_lock(&sbi->wq_mutex);
if (!--wq->wait_ctr)
- kfree(wq);
+ autofs_free_wait_queue(wq);
mutex_unlock(&sbi->wq_mutex);
return status;
@@ -554,7 +561,7 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok
wq->status = status;
wake_up_interruptible(&wq->queue);
if (!--wq->wait_ctr)
- kfree(wq);
+ autofs_free_wait_queue(wq);
mutex_unlock(&sbi->wq_mutex);
return 0;
--
1.7.7
next prev parent reply other threads:[~2012-09-19 15:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-19 15:29 [PATCH 0/2] struct pid-ify autofs4 Miklos Szeredi
2012-09-19 15:29 ` [PATCH 1/2] Replace pid_t in autofs4 with struct pid reference Miklos Szeredi
2012-09-19 15:29 ` Miklos Szeredi [this message]
2012-09-21 15:44 ` [PATCH 0/2] struct pid-ify autofs4 Miklos Szeredi
2012-09-24 0:38 ` Ian Kent
2012-09-24 13:34 ` Miklos Szeredi
2012-09-25 1:46 ` Ian Kent
2012-09-25 2:56 ` Eric W. Biederman
2012-10-11 3:34 ` Ian Kent
2012-10-24 14:59 ` Miklos Szeredi
2012-10-25 0:25 ` Ian Kent
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348068576-21363-3-git-send-email-miklos@szeredi.hu \
--to=miklos@szeredi.hu \
--cc=autofs@vger.kernel.org \
--cc=ebiederm@xmission.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mszeredi@suse.cz \
--cc=raven@themaw.net \
--cc=serge.hallyn@canonical.com \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).