mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
lockd: Plug nlm_file leak when nlm_do_fopen() fails
A client can repeatedly drive nlm_do_fopen() failures by presenting
file handles that the underlying export rejects. After kzalloc_obj()
succeeds in nlm_lookup_file(), the freshly allocated nlm_file is not
yet inserted into nlm_files[]. The nlm_do_fopen() failure path jumps
to out_unlock, which releases nlm_file_mutex and returns without
freeing the allocation, so each failure leaks one nlm_file.
Route the failure through out_free so kfree() runs before the
function returns.
Fixes: 7f024fcd5c ("Keep read and write fds with each nlm_file")
Cc: stable@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
516403d4d8
commit
f16a151345
|
|
@ -166,7 +166,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
|
|||
|
||||
nfserr = nlm_do_fopen(rqstp, file, mode);
|
||||
if (nfserr)
|
||||
goto out_unlock;
|
||||
goto out_free;
|
||||
|
||||
hlist_add_head(&file->f_list, &nlm_files[hash]);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user