aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-05-16 16:16:39 -0400
committerAlex Elder <elder@dreamhost.com>2012-05-17 09:18:13 -0400
commita255651d4cad89f1a606edd36135af892ada4f20 (patch)
tree6d2c694b336f948272349e5de24be70460a94826 /fs/ceph
parent74f1869f76d043bad12ec03b4d5f04a8c3d1f157 (diff)
ceph: ensure auth ops are defined before use
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>
Diffstat (limited to 'fs/ceph')
-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,
3406 int ret = 0; 3406 int ret = 0;
3407 3407
3408 if (force_new && auth->authorizer) { 3408 if (force_new && auth->authorizer) {
3409 ac->ops->destroy_authorizer(ac, auth->authorizer); 3409 if (ac->ops && ac->ops->destroy_authorizer)
3410 ac->ops->destroy_authorizer(ac, auth->authorizer);
3410 auth->authorizer = NULL; 3411 auth->authorizer = NULL;
3411 } 3412 }
3412 if (auth->authorizer == NULL) { 3413 if (!auth->authorizer && ac->ops && ac->ops->create_authorizer) {
3413 if (ac->ops->create_authorizer) { 3414 ret = ac->ops->create_authorizer(ac, CEPH_ENTITY_TYPE_MDS, auth);
3414 ret = ac->ops->create_authorizer(ac, 3415 if (ret)
3415 CEPH_ENTITY_TYPE_MDS, auth); 3416 return ret;
3416 if (ret)
3417 return ret;
3418 }
3419 } 3417 }
3420 3418
3421 *proto = ac->protocol; 3419 *proto = ac->protocol;