mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
staging: lustre: ldlm: free resource when ldlm_lock_create() fails.
[ Upstream commit d8caf662b4
]
ldlm_lock_create() gets a resource, but don't put it on
all failure paths. It should.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e906355a7f
commit
41e1f1feee
1 changed files with 5 additions and 1 deletions
|
@ -1571,8 +1571,10 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
|
|||
return ERR_CAST(res);
|
||||
|
||||
lock = ldlm_lock_new(res);
|
||||
if (!lock)
|
||||
if (!lock) {
|
||||
ldlm_resource_putref(res);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
lock->l_req_mode = mode;
|
||||
lock->l_ast_data = data;
|
||||
|
@ -1615,6 +1617,8 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
|
|||
return ERR_PTR(rc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Enqueue (request) a lock.
|
||||
* On the client this is called from ldlm_cli_enqueue_fini
|
||||
|
|
Loading…
Reference in a new issue