summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-05-16 15:16:39 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-26 11:38:07 -0800
commit83d28f7956228e0dd1774aed1096392d3bfc0597 (patch)
treec0d9780e35f34d0732bfbaa161f2ca3bd5f53768 /fs
parent018a2a13f3cb5e205618b1357124ff25eb3a8223 (diff)
ceph: ensure auth ops are defined before use
(cherry picked from commit a255651d4cad89f1a606edd36135af892ada4f20) In the create_authorizer method for both the mds and osd clients, the auth_client->ops pointer is blindly dereferenced. There is no obvious guarantee that this pointer has been assigned. And furthermore, even if the ops pointer is non-null there is definitely no guarantee that the create_authorizer or destroy_authorizer methods are defined. Add checks in both routines to make sure they are defined (non-null) before use. Add similar checks in a few other spots in these files while we're at it. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ceph/mds_client.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index b71ffd2c8094..462281742aef 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -3406,16 +3406,14 @@ static int get_authorizer(struct ceph_connection *con,
int ret = 0;
if (force_new && auth->authorizer) {
- ac->ops->destroy_authorizer(ac, auth->authorizer);
+ if (ac->ops && ac->ops->destroy_authorizer)
+ ac->ops->destroy_authorizer(ac, auth->authorizer);
auth->authorizer = NULL;
}
- if (auth->authorizer == NULL) {
- if (ac->ops->create_authorizer) {
- ret = ac->ops->create_authorizer(ac,
- CEPH_ENTITY_TYPE_MDS, auth);
- if (ret)
- return ret;
- }
+ if (!auth->authorizer && ac->ops && ac->ops->create_authorizer) {
+ ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_MDS, auth);
+ if (ret)
+ return ret;
}
*proto = ac->protocol;