aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/xdr4.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:06 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:06 -0500
commit7bab377fcb495ee2e5a1cd69d235f8d84c76e3af (patch)
tree67f03fbc543632ccf71075af250635201b43801b /fs/lockd/xdr4.c
parent36943fa4b2701b9ef2d60084c85ecbe634aec252 (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/xdr4.c')
-rw-r--r--fs/lockd/xdr4.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
index fdcf105a5303..906ddc203186 100644
--- a/fs/lockd/xdr4.c
+++ b/fs/lockd/xdr4.c
@@ -130,10 +130,11 @@ nlm4_decode_lock(u32 *p, struct nlm_lock *lock)
130 || !(p = nlm4_decode_fh(p, &lock->fh)) 130 || !(p = nlm4_decode_fh(p, &lock->fh))
131 || !(p = nlm4_decode_oh(p, &lock->oh))) 131 || !(p = nlm4_decode_oh(p, &lock->oh)))
132 return NULL; 132 return NULL;
133 lock->svid = ntohl(*p++);
133 134
134 locks_init_lock(fl); 135 locks_init_lock(fl);
135 fl->fl_owner = current->files; 136 fl->fl_owner = current->files;
136 fl->fl_pid = ntohl(*p++); 137 fl->fl_pid = (pid_t)lock->svid;
137 fl->fl_flags = FL_POSIX; 138 fl->fl_flags = FL_POSIX;
138 fl->fl_type = F_RDLCK; /* as good as anything else */ 139 fl->fl_type = F_RDLCK; /* as good as anything else */
139 p = xdr_decode_hyper(p, &start); 140 p = xdr_decode_hyper(p, &start);
@@ -167,7 +168,7 @@ nlm4_encode_lock(u32 *p, struct nlm_lock *lock)
167 || (fl->fl_end > NLM4_OFFSET_MAX && fl->fl_end != OFFSET_MAX)) 168 || (fl->fl_end > NLM4_OFFSET_MAX && fl->fl_end != OFFSET_MAX))
168 return NULL; 169 return NULL;
169 170
170 *p++ = htonl(fl->fl_pid); 171 *p++ = htonl(lock->svid);
171 172
172 start = loff_t_to_s64(fl->fl_start); 173 start = loff_t_to_s64(fl->fl_start);
173 if (fl->fl_end == OFFSET_MAX) 174 if (fl->fl_end == OFFSET_MAX)
@@ -198,7 +199,7 @@ nlm4_encode_testres(u32 *p, struct nlm_res *resp)
198 struct file_lock *fl = &resp->lock.fl; 199 struct file_lock *fl = &resp->lock.fl;
199 200
200 *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one; 201 *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one;
201 *p++ = htonl(fl->fl_pid); 202 *p++ = htonl(resp->lock.svid);
202 203
203 /* Encode owner handle. */ 204 /* Encode owner handle. */
204 if (!(p = xdr_encode_netobj(p, &resp->lock.oh))) 205 if (!(p = xdr_encode_netobj(p, &resp->lock.oh)))
@@ -212,8 +213,8 @@ nlm4_encode_testres(u32 *p, struct nlm_res *resp)
212 213
213 p = xdr_encode_hyper(p, start); 214 p = xdr_encode_hyper(p, start);
214 p = xdr_encode_hyper(p, len); 215 p = xdr_encode_hyper(p, len);
215 dprintk("xdr: encode_testres (status %d pid %d type %d start %Ld end %Ld)\n", 216 dprintk("xdr: encode_testres (status %u pid %d type %d start %Ld end %Ld)\n",
216 resp->status, fl->fl_pid, fl->fl_type, 217 resp->status, (int)resp->lock.svid, fl->fl_type,
217 (long long)fl->fl_start, (long long)fl->fl_end); 218 (long long)fl->fl_start, (long long)fl->fl_end);
218 } 219 }
219 220
@@ -303,7 +304,8 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
303 304
304 memset(lock, 0, sizeof(*lock)); 305 memset(lock, 0, sizeof(*lock));
305 locks_init_lock(&lock->fl); 306 locks_init_lock(&lock->fl);
306 lock->fl.fl_pid = ~(u32) 0; 307 lock->svid = ~(u32) 0;
308 lock->fl.fl_pid = (pid_t)lock->svid;
307 309
308 if (!(p = nlm4_decode_cookie(p, &argp->cookie)) 310 if (!(p = nlm4_decode_cookie(p, &argp->cookie))
309 || !(p = xdr_decode_string_inplace(p, &lock->caller, 311 || !(p = xdr_decode_string_inplace(p, &lock->caller,
@@ -420,7 +422,8 @@ nlm4clt_decode_testres(struct rpc_rqst *req, u32 *p, struct nlm_res *resp)
420 memset(&resp->lock, 0, sizeof(resp->lock)); 422 memset(&resp->lock, 0, sizeof(resp->lock));
421 locks_init_lock(fl); 423 locks_init_lock(fl);
422 excl = ntohl(*p++); 424 excl = ntohl(*p++);
423 fl->fl_pid = ntohl(*p++); 425 resp->lock.svid = ntohl(*p++);
426 fl->fl_pid = (pid_t)resp->lock.svid;
424 if (!(p = nlm4_decode_oh(p, &resp->lock.oh))) 427 if (!(p = nlm4_decode_oh(p, &resp->lock.oh)))
425 return -EIO; 428 return -EIO;
426 429