Skip to content

Commit 591ea9c

Browse files
idryomovgregkh
authored andcommitted
libceph: fix invalid accesses to ceph_connection_v1_info
commit cdbc983 upstream. There is a place where generic code in messenger.c is reading and another place where it is writing to con->v1 union member without checking that the union member is active (i.e. msgr1 is in use). On 64-bit systems, con->v1.auth_retry overlaps with con->v2.out_iter, so such a read is almost guaranteed to return a bogus value instead of 0 when msgr2 is in use. This ends up being fairly benign because the side effect is just the invalidation of the authorizer and successive fetching of new tickets. con->v1.connect_seq overlaps with con->v2.conn_bufs and the fact that it's being written to can cause more serious consequences, but luckily it's not something that happens often. Cc: stable@vger.kernel.org Fixes: cd1a677 ("libceph, ceph: implement msgr2.1 protocol (crc and secure modes)") Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c079916 commit 591ea9c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

net/ceph/messenger.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ static void con_fault_finish(struct ceph_connection *con)
14531453
* in case we faulted due to authentication, invalidate our
14541454
* current tickets so that we can get new ones.
14551455
*/
1456-
if (con->v1.auth_retry) {
1456+
if (!ceph_msgr2(from_msgr(con->msgr)) && con->v1.auth_retry) {
14571457
dout("auth_retry %d, invalidating\n", con->v1.auth_retry);
14581458
if (con->ops->invalidate_authorizer)
14591459
con->ops->invalidate_authorizer(con);
@@ -1643,9 +1643,10 @@ static void clear_standby(struct ceph_connection *con)
16431643
{
16441644
/* come back from STANDBY? */
16451645
if (con->state == CEPH_CON_S_STANDBY) {
1646-
dout("clear_standby %p and ++connect_seq\n", con);
1646+
dout("clear_standby %p\n", con);
16471647
con->state = CEPH_CON_S_PREOPEN;
1648-
con->v1.connect_seq++;
1648+
if (!ceph_msgr2(from_msgr(con->msgr)))
1649+
con->v1.connect_seq++;
16491650
WARN_ON(ceph_con_flag_test(con, CEPH_CON_F_WRITE_PENDING));
16501651
WARN_ON(ceph_con_flag_test(con, CEPH_CON_F_KEEPALIVE_PENDING));
16511652
}

0 commit comments

Comments
 (0)