Skip to content

Commit a5a3737

Browse files
committed
libceph: admit message frames only in CEPH_CON_S_OPEN state
Similar checks are performed for all control frames, but an early check for message frames was missing. process_message() is already set up to terminate the loop in case the state changes while con->ops->dispatch() handler is being executed. Cc: [email protected] Signed-off-by: Ilya Dryomov <[email protected]> Reviewed-by: Alex Markuze <[email protected]> Reviewed-by: Viacheslav Dubeyko <[email protected]>
1 parent 69fb5d9 commit a5a3737

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

net/ceph/messenger_v2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2905,6 +2905,11 @@ static int __handle_control(struct ceph_connection *con, void *p)
29052905
if (con->v2.in_desc.fd_tag != FRAME_TAG_MESSAGE)
29062906
return process_control(con, p, end);
29072907

2908+
if (con->state != CEPH_CON_S_OPEN) {
2909+
con->error_msg = "protocol error, unexpected message";
2910+
return -EINVAL;
2911+
}
2912+
29082913
ret = process_message_header(con, p, end);
29092914
if (ret < 0)
29102915
return ret;

0 commit comments

Comments
 (0)