Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: messenger: check return from get_authorizer

In prepare_connect_authorizer(), a connection's get_authorizer
method is called but ignores its return value. This function can
return an error, so check for it and return it if that ever occurs.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>

authored by

Alex Elder and committed by
Alex Elder
ed96af64 b1c6b980

+7 -3
+7 -3
net/ceph/messenger.c
··· 658 658 void *auth_buf; 659 659 int auth_len; 660 660 int auth_protocol; 661 + int ret; 661 662 662 663 if (!con->ops->get_authorizer) { 663 664 con->out_connect.authorizer_protocol = CEPH_AUTH_UNKNOWN; ··· 674 673 auth_buf = NULL; 675 674 auth_len = 0; 676 675 auth_protocol = CEPH_AUTH_UNKNOWN; 677 - con->ops->get_authorizer(con, &auth_buf, &auth_len, &auth_protocol, 678 - &con->auth_reply_buf, &con->auth_reply_buf_len, 679 - con->auth_retry); 676 + ret = con->ops->get_authorizer(con, &auth_buf, &auth_len, 677 + &auth_protocol, &con->auth_reply_buf, 678 + &con->auth_reply_buf_len, con->auth_retry); 680 679 mutex_lock(&con->mutex); 680 + 681 + if (ret) 682 + return ret; 681 683 682 684 if (test_bit(CLOSED, &con->state) || test_bit(OPENING, &con->state)) 683 685 return -EAGAIN;