Commit c18d68c7 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

staging: lustre: ldlm: free resource when ldlm_lock_create() fails.

[ Upstream commit d8caf662 ]

ldlm_lock_create() gets a resource, but don't put it on
all failure paths. It should.
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Reviewed-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1c802923
...@@ -1489,8 +1489,10 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, ...@@ -1489,8 +1489,10 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
return ERR_CAST(res); return ERR_CAST(res);
lock = ldlm_lock_new(res); lock = ldlm_lock_new(res);
if (!lock) if (!lock) {
ldlm_resource_putref(res);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
lock->l_req_mode = mode; lock->l_req_mode = mode;
lock->l_ast_data = data; lock->l_ast_data = data;
...@@ -1533,6 +1535,8 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns, ...@@ -1533,6 +1535,8 @@ struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
return ERR_PTR(rc); return ERR_PTR(rc);
} }
/** /**
* Enqueue (request) a lock. * Enqueue (request) a lock.
* On the client this is called from ldlm_cli_enqueue_fini * On the client this is called from ldlm_cli_enqueue_fini
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment