]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
libceph: admit message frames only in CEPH_CON_S_OPEN state
authorIlya Dryomov <idryomov@gmail.com>
Sun, 8 Mar 2026 16:57:23 +0000 (17:57 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 10 Mar 2026 11:15:46 +0000 (12:15 +0100)
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: stable@vger.kernel.org
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Alex Markuze <amarkuze@redhat.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
net/ceph/messenger_v2.c

index ed618435d33a6c144a3895d1b3f89ec538d369e9..c4ddf7911f7d72c4073e6bf88ac4478ed2143653 100644 (file)
@@ -2905,6 +2905,11 @@ static int __handle_control(struct ceph_connection *con, void *p)
        if (con->v2.in_desc.fd_tag != FRAME_TAG_MESSAGE)
                return process_control(con, p, end);
 
+       if (con->state != CEPH_CON_S_OPEN) {
+               con->error_msg = "protocol error, unexpected message";
+               return -EINVAL;
+       }
+
        ret = process_message_header(con, p, end);
        if (ret < 0)
                return ret;