Skip to content

Commit 3c0d089

Browse files
committed
libceph: don't pass result into ac->ops->handle_reply()
There is no result to pass in msgr2 case because authentication failures are reported through auth_bad_method frame and in MAuth case an error is returned immediately. Signed-off-by: Ilya Dryomov <[email protected]> Reviewed-by: Jeff Layton <[email protected]>
1 parent 7a971e2 commit 3c0d089

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

include/linux/ceph/auth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct ceph_auth_client_ops {
5050
* another request.
5151
*/
5252
int (*build_request)(struct ceph_auth_client *ac, void *buf, void *end);
53-
int (*handle_reply)(struct ceph_auth_client *ac, int result,
53+
int (*handle_reply)(struct ceph_auth_client *ac,
5454
void *buf, void *end, u8 *session_key,
5555
int *session_key_len, u8 *con_secret,
5656
int *con_secret_len);

net/ceph/auth.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,19 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac,
260260
ac->negotiating = false;
261261
}
262262

263-
ret = ac->ops->handle_reply(ac, result, payload, payload_end,
263+
if (result) {
264+
pr_err("auth protocol '%s' mauth authentication failed: %d\n",
265+
ceph_auth_proto_name(ac->protocol), result);
266+
ret = result;
267+
goto out;
268+
}
269+
270+
ret = ac->ops->handle_reply(ac, payload, payload_end,
264271
NULL, NULL, NULL, NULL);
265272
if (ret == -EAGAIN) {
266273
ret = build_request(ac, true, reply_buf, reply_len);
267274
goto out;
268275
} else if (ret) {
269-
pr_err("auth protocol '%s' mauth authentication failed: %d\n",
270-
ceph_auth_proto_name(ac->protocol), result);
271276
goto out;
272277
}
273278

@@ -480,7 +485,7 @@ int ceph_auth_handle_reply_more(struct ceph_auth_client *ac, void *reply,
480485
int ret;
481486

482487
mutex_lock(&ac->mutex);
483-
ret = ac->ops->handle_reply(ac, 0, reply, reply + reply_len,
488+
ret = ac->ops->handle_reply(ac, reply, reply + reply_len,
484489
NULL, NULL, NULL, NULL);
485490
if (ret == -EAGAIN)
486491
ret = build_request(ac, false, buf, buf_len);
@@ -498,7 +503,7 @@ int ceph_auth_handle_reply_done(struct ceph_auth_client *ac,
498503
int ret;
499504

500505
mutex_lock(&ac->mutex);
501-
ret = ac->ops->handle_reply(ac, 0, reply, reply + reply_len,
506+
ret = ac->ops->handle_reply(ac, reply, reply + reply_len,
502507
session_key, session_key_len,
503508
con_secret, con_secret_len);
504509
if (!ret)

net/ceph/auth_none.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ static int build_request(struct ceph_auth_client *ac, void *buf, void *end)
6969
* the generic auth code decode the global_id, and we carry no actual
7070
* authenticate state, so nothing happens here.
7171
*/
72-
static int handle_reply(struct ceph_auth_client *ac, int result,
72+
static int handle_reply(struct ceph_auth_client *ac,
7373
void *buf, void *end, u8 *session_key,
7474
int *session_key_len, u8 *con_secret,
7575
int *con_secret_len)
7676
{
7777
struct ceph_auth_none_info *xi = ac->private;
7878

7979
xi->starting = false;
80-
return result;
80+
return 0;
8181
}
8282

8383
static void ceph_auth_none_destroy_authorizer(struct ceph_authorizer *a)

net/ceph/auth_x.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,21 +661,19 @@ static int handle_auth_session_key(struct ceph_auth_client *ac,
661661
return -EINVAL;
662662
}
663663

664-
static int ceph_x_handle_reply(struct ceph_auth_client *ac, int result,
664+
static int ceph_x_handle_reply(struct ceph_auth_client *ac,
665665
void *buf, void *end,
666666
u8 *session_key, int *session_key_len,
667667
u8 *con_secret, int *con_secret_len)
668668
{
669669
struct ceph_x_info *xi = ac->private;
670670
struct ceph_x_ticket_handler *th;
671671
int len = end - buf;
672+
int result;
672673
void *p;
673674
int op;
674675
int ret;
675676

676-
if (result)
677-
return result; /* XXX hmm? */
678-
679677
if (xi->starting) {
680678
/* it's a hello */
681679
struct ceph_x_server_challenge *sc = buf;

0 commit comments

Comments
 (0)