Commit 930357a9 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: pre-zero response for lockd _msg requests.

All the lockd *_msg requests are implemented by
calling the equivalent non- *_msg request and sending off
the response as a new message (*_res).

For the non- *_msg requests, the response buffer is
pre-zeroed by the RPC layer, but the *_msg handlers weren't
pre-zeroing the buffer, would could in some circumstances lead to
an Oops.

Now we pre-zero them all.
parent 7fffa27d
...@@ -244,6 +244,7 @@ nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -244,6 +244,7 @@ nlm4svc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: TEST_MSG called\n"); dprintk("lockd: TEST_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlm4svc_proc_test(rqstp, argp, &res)) == 0) if ((stat = nlm4svc_proc_test(rqstp, argp, &res)) == 0)
stat = nlm4svc_callback(rqstp, NLMPROC_TEST_RES, &res); stat = nlm4svc_callback(rqstp, NLMPROC_TEST_RES, &res);
...@@ -258,6 +259,7 @@ nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -258,6 +259,7 @@ nlm4svc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: LOCK_MSG called\n"); dprintk("lockd: LOCK_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlm4svc_proc_lock(rqstp, argp, &res)) == 0) if ((stat = nlm4svc_proc_lock(rqstp, argp, &res)) == 0)
stat = nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, &res); stat = nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, &res);
...@@ -272,6 +274,7 @@ nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -272,6 +274,7 @@ nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: CANCEL_MSG called\n"); dprintk("lockd: CANCEL_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlm4svc_proc_cancel(rqstp, argp, &res)) == 0) if ((stat = nlm4svc_proc_cancel(rqstp, argp, &res)) == 0)
stat = nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, &res); stat = nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, &res);
...@@ -286,6 +289,7 @@ nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -286,6 +289,7 @@ nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: UNLOCK_MSG called\n"); dprintk("lockd: UNLOCK_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlm4svc_proc_unlock(rqstp, argp, &res)) == 0) if ((stat = nlm4svc_proc_unlock(rqstp, argp, &res)) == 0)
stat = nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, &res); stat = nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, &res);
...@@ -300,6 +304,7 @@ nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -300,6 +304,7 @@ nlm4svc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: GRANTED_MSG called\n"); dprintk("lockd: GRANTED_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlm4svc_proc_granted(rqstp, argp, &res)) == 0) if ((stat = nlm4svc_proc_granted(rqstp, argp, &res)) == 0)
stat = nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, &res); stat = nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, &res);
......
...@@ -272,6 +272,7 @@ nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -272,6 +272,7 @@ nlmsvc_proc_test_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: TEST_MSG called\n"); dprintk("lockd: TEST_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlmsvc_proc_test(rqstp, argp, &res)) == 0) if ((stat = nlmsvc_proc_test(rqstp, argp, &res)) == 0)
stat = nlmsvc_callback(rqstp, NLMPROC_TEST_RES, &res); stat = nlmsvc_callback(rqstp, NLMPROC_TEST_RES, &res);
...@@ -286,6 +287,7 @@ nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -286,6 +287,7 @@ nlmsvc_proc_lock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: LOCK_MSG called\n"); dprintk("lockd: LOCK_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlmsvc_proc_lock(rqstp, argp, &res)) == 0) if ((stat = nlmsvc_proc_lock(rqstp, argp, &res)) == 0)
stat = nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, &res); stat = nlmsvc_callback(rqstp, NLMPROC_LOCK_RES, &res);
...@@ -300,6 +302,7 @@ nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -300,6 +302,7 @@ nlmsvc_proc_cancel_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: CANCEL_MSG called\n"); dprintk("lockd: CANCEL_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlmsvc_proc_cancel(rqstp, argp, &res)) == 0) if ((stat = nlmsvc_proc_cancel(rqstp, argp, &res)) == 0)
stat = nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, &res); stat = nlmsvc_callback(rqstp, NLMPROC_CANCEL_RES, &res);
...@@ -314,6 +317,7 @@ nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -314,6 +317,7 @@ nlmsvc_proc_unlock_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: UNLOCK_MSG called\n"); dprintk("lockd: UNLOCK_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlmsvc_proc_unlock(rqstp, argp, &res)) == 0) if ((stat = nlmsvc_proc_unlock(rqstp, argp, &res)) == 0)
stat = nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, &res); stat = nlmsvc_callback(rqstp, NLMPROC_UNLOCK_RES, &res);
...@@ -328,6 +332,7 @@ nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp, ...@@ -328,6 +332,7 @@ nlmsvc_proc_granted_msg(struct svc_rqst *rqstp, struct nlm_args *argp,
u32 stat; u32 stat;
dprintk("lockd: GRANTED_MSG called\n"); dprintk("lockd: GRANTED_MSG called\n");
memset(&res, 0, sizeof(res));
if ((stat = nlmsvc_proc_granted(rqstp, argp, &res)) == 0) if ((stat = nlmsvc_proc_granted(rqstp, argp, &res)) == 0)
stat = nlmsvc_callback(rqstp, NLMPROC_GRANTED_RES, &res); stat = nlmsvc_callback(rqstp, NLMPROC_GRANTED_RES, &res);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment