diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:06 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:06 -0500 |
commit | 7bab377fcb495ee2e5a1cd69d235f8d84c76e3af (patch) | |
tree | 67f03fbc543632ccf71075af250635201b43801b /fs/lockd/xdr.c | |
parent | 36943fa4b2701b9ef2d60084c85ecbe634aec252 (diff) |
lockd: Don't expose the process pid to the NLM server
Instead we use the nlm_lockowner->pid.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/lockd/xdr.c')
-rw-r--r-- | fs/lockd/xdr.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c index 200fbda2c6d1..1e984ab14d3f 100644 --- a/fs/lockd/xdr.c +++ b/fs/lockd/xdr.c | |||
@@ -131,10 +131,11 @@ nlm_decode_lock(u32 *p, struct nlm_lock *lock) | |||
131 | || !(p = nlm_decode_fh(p, &lock->fh)) | 131 | || !(p = nlm_decode_fh(p, &lock->fh)) |
132 | || !(p = nlm_decode_oh(p, &lock->oh))) | 132 | || !(p = nlm_decode_oh(p, &lock->oh))) |
133 | return NULL; | 133 | return NULL; |
134 | lock->svid = ntohl(*p++); | ||
134 | 135 | ||
135 | locks_init_lock(fl); | 136 | locks_init_lock(fl); |
136 | fl->fl_owner = current->files; | 137 | fl->fl_owner = current->files; |
137 | fl->fl_pid = ntohl(*p++); | 138 | fl->fl_pid = (pid_t)lock->svid; |
138 | fl->fl_flags = FL_POSIX; | 139 | fl->fl_flags = FL_POSIX; |
139 | fl->fl_type = F_RDLCK; /* as good as anything else */ | 140 | fl->fl_type = F_RDLCK; /* as good as anything else */ |
140 | start = ntohl(*p++); | 141 | start = ntohl(*p++); |
@@ -174,7 +175,7 @@ nlm_encode_lock(u32 *p, struct nlm_lock *lock) | |||
174 | else | 175 | else |
175 | len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1); | 176 | len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1); |
176 | 177 | ||
177 | *p++ = htonl(fl->fl_pid); | 178 | *p++ = htonl(lock->svid); |
178 | *p++ = htonl(start); | 179 | *p++ = htonl(start); |
179 | *p++ = htonl(len); | 180 | *p++ = htonl(len); |
180 | 181 | ||
@@ -197,7 +198,7 @@ nlm_encode_testres(u32 *p, struct nlm_res *resp) | |||
197 | struct file_lock *fl = &resp->lock.fl; | 198 | struct file_lock *fl = &resp->lock.fl; |
198 | 199 | ||
199 | *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one; | 200 | *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one; |
200 | *p++ = htonl(fl->fl_pid); | 201 | *p++ = htonl(resp->lock.svid); |
201 | 202 | ||
202 | /* Encode owner handle. */ | 203 | /* Encode owner handle. */ |
203 | if (!(p = xdr_encode_netobj(p, &resp->lock.oh))) | 204 | if (!(p = xdr_encode_netobj(p, &resp->lock.oh))) |
@@ -298,7 +299,8 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp) | |||
298 | 299 | ||
299 | memset(lock, 0, sizeof(*lock)); | 300 | memset(lock, 0, sizeof(*lock)); |
300 | locks_init_lock(&lock->fl); | 301 | locks_init_lock(&lock->fl); |
301 | lock->fl.fl_pid = ~(u32) 0; | 302 | lock->svid = ~(u32) 0; |
303 | lock->fl.fl_pid = (pid_t)lock->svid; | ||
302 | 304 | ||
303 | if (!(p = nlm_decode_cookie(p, &argp->cookie)) | 305 | if (!(p = nlm_decode_cookie(p, &argp->cookie)) |
304 | || !(p = xdr_decode_string_inplace(p, &lock->caller, | 306 | || !(p = xdr_decode_string_inplace(p, &lock->caller, |
@@ -415,7 +417,8 @@ nlmclt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp) | |||
415 | memset(&resp->lock, 0, sizeof(resp->lock)); | 417 | memset(&resp->lock, 0, sizeof(resp->lock)); |
416 | locks_init_lock(fl); | 418 | locks_init_lock(fl); |
417 | excl = ntohl(*p++); | 419 | excl = ntohl(*p++); |
418 | fl->fl_pid = ntohl(*p++); | 420 | resp->lock.svid = ntohl(*p++); |
421 | fl->fl_pid = (pid_t)resp->lock.svid; | ||
419 | if (!(p = nlm_decode_oh(p, &resp->lock.oh))) | 422 | if (!(p = nlm_decode_oh(p, &resp->lock.oh))) |
420 | return -EIO; | 423 | return -EIO; |
421 | 424 | ||