Skip to content

Commit

Permalink
libceph: ceph_build_auth() doesn't need ceph_auth_build_hello()
Browse files Browse the repository at this point in the history
A static bug finder (EBA) on Linux 4.7:

    Double lock in net/ceph/auth.c
    second lock at 108: mutex_lock(& ac->mutex); [ceph_auth_build_hello]
    after calling from 263: ret = ceph_auth_build_hello(ac, msg_buf, msg_len);
    if ! ac->protocol -> true at 262
    first lock at 261: mutex_lock(& ac->mutex); [ceph_build_auth]

ceph_auth_build_hello() is never called, because the protocol is always
initialized, whether we are checking existing tickets (in delayed_work())
or getting new ones after invalidation (in invalidate_authorizer()).

Reported-by: Iago Abal <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
  • Loading branch information
idryomov committed Oct 3, 2016
1 parent fdc723e commit 464691b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/ceph/auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ int ceph_build_auth(struct ceph_auth_client *ac,
int ret = 0;

mutex_lock(&ac->mutex);
if (!ac->protocol)
ret = ceph_auth_build_hello(ac, msg_buf, msg_len);
else if (ac->ops->should_authenticate(ac))
if (ac->ops->should_authenticate(ac))
ret = ceph_build_auth_request(ac, msg_buf, msg_len);
mutex_unlock(&ac->mutex);
return ret;
Expand Down

0 comments on commit 464691b

Please sign in to comment.