diff options
author | Tim Gardner <tim.gardner@canonical.com> | 2013-02-13 10:40:16 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2013-02-15 11:29:38 -0500 |
commit | f25cc71e634edcf8a15bc60a48f2b5f3ec9fbb1d (patch) | |
tree | b66f98dacd1c095dfded8ee673290230366dd8c8 /fs/lockd/clntproc.c | |
parent | deb4534f4f3be7aea7d9d24c3b0d58f370cbf9ef (diff) |
lockd: nlmclnt_reclaim(): avoid stack overflow
Even though nlmclnt_reclaim() is only one call into the stack frame,
928 bytes on the stack seems like a lot. Recode to dynamically
allocate the request structure once from within the reclaimer task,
then pass this pointer into nlmclnt_reclaim() for reuse on
subsequent calls.
smatch analysis:
fs/lockd/clntproc.c:620 nlmclnt_reclaim() warn: 'reqst' puts
928 bytes on stack
Also remove redundant assignment of 0 after memset.
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/lockd/clntproc.c')
-rw-r--r-- | fs/lockd/clntproc.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index 54f9e6ce0430..b43114c4332a 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -615,17 +615,15 @@ out_unlock: | |||
615 | * RECLAIM: Try to reclaim a lock | 615 | * RECLAIM: Try to reclaim a lock |
616 | */ | 616 | */ |
617 | int | 617 | int |
618 | nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl) | 618 | nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl, |
619 | struct nlm_rqst *req) | ||
619 | { | 620 | { |
620 | struct nlm_rqst reqst, *req; | ||
621 | int status; | 621 | int status; |
622 | 622 | ||
623 | req = &reqst; | ||
624 | memset(req, 0, sizeof(*req)); | 623 | memset(req, 0, sizeof(*req)); |
625 | locks_init_lock(&req->a_args.lock.fl); | 624 | locks_init_lock(&req->a_args.lock.fl); |
626 | locks_init_lock(&req->a_res.lock.fl); | 625 | locks_init_lock(&req->a_res.lock.fl); |
627 | req->a_host = host; | 626 | req->a_host = host; |
628 | req->a_flags = 0; | ||
629 | 627 | ||
630 | /* Set up the argument struct */ | 628 | /* Set up the argument struct */ |
631 | nlmclnt_setlockargs(req, fl); | 629 | nlmclnt_setlockargs(req, fl); |