From: Trond Myklebust Date: Tue, 9 Oct 2007 15:04:57 +0000 (-0400) Subject: NLM: Fix a memory leak in nlmsvc_testlock X-Git-Tag: v2.6.23~2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=a6d85430424d44e946e0946bfaad607115510989;p=linux-2.6-omap-h63xx.git NLM: Fix a memory leak in nlmsvc_testlock The recent fix for a circular lock dependency unfortunately introduced a potential memory leak in the event where the call to nlmsvc_lookup_host fails for some reason. Thanks to Roel Kluin for spotting this. Signed-off-by: Trond Myklebust Signed-off-by: Linus Torvalds --- diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index d098c7af0d2..d120ec39bcb 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c @@ -485,8 +485,10 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, return nlm_granted; /* Create host handle for callback */ host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len); - if (host == NULL) + if (host == NULL) { + kfree(conf); return nlm_lck_denied_nolocks; + } block = nlmsvc_create_block(rqstp, host, file, lock, cookie); if (block == NULL) { kfree(conf);