Commit a6d85430424d44e946e0946bfaad607115510989
Committed by
Linus Torvalds
1 parent
baf14aa14e
Exists in
master
and in
20 other branches
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 <Trond.Myklebust@netapp.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff
fs/lockd/svclock.c
... | ... | @@ -485,8 +485,10 @@ |
485 | 485 | return nlm_granted; |
486 | 486 | /* Create host handle for callback */ |
487 | 487 | host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len); |
488 | - if (host == NULL) | |
488 | + if (host == NULL) { | |
489 | + kfree(conf); | |
489 | 490 | return nlm_lck_denied_nolocks; |
491 | + } | |
490 | 492 | block = nlmsvc_create_block(rqstp, host, file, lock, cookie); |
491 | 493 | if (block == NULL) { |
492 | 494 | kfree(conf); |