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>
This commit is contained in:

committed by
J. Bruce Fields

parent
deb4534f4f
commit
f25cc71e63
@@ -615,17 +615,15 @@ out_unlock:
|
||||
* RECLAIM: Try to reclaim a lock
|
||||
*/
|
||||
int
|
||||
nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl)
|
||||
nlmclnt_reclaim(struct nlm_host *host, struct file_lock *fl,
|
||||
struct nlm_rqst *req)
|
||||
{
|
||||
struct nlm_rqst reqst, *req;
|
||||
int status;
|
||||
|
||||
req = &reqst;
|
||||
memset(req, 0, sizeof(*req));
|
||||
locks_init_lock(&req->a_args.lock.fl);
|
||||
locks_init_lock(&req->a_res.lock.fl);
|
||||
req->a_host = host;
|
||||
req->a_flags = 0;
|
||||
|
||||
/* Set up the argument struct */
|
||||
nlmclnt_setlockargs(req, fl);
|
||||
|
Reference in New Issue
Block a user