Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2191034iof; Tue, 7 Jun 2022 22:42:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYv31Byyiqz79D7fcAKtFJ2xKXqctzjw9tmVVOrare93SVwTvPwuqCas4CW64p1zPfTsc9 X-Received: by 2002:a63:f453:0:b0:3fc:7939:9654 with SMTP id p19-20020a63f453000000b003fc79399654mr28556259pgk.341.1654666928060; Tue, 07 Jun 2022 22:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654666928; cv=none; d=google.com; s=arc-20160816; b=o1JpYyZ053fqkrrpADyscbyYHqdegdqt/BUi8OIbX80HxDUYd2CmLRQ+ocsC4AJfZn 8kn/B/rdQm4x0gSKMvE/F4wfwZrp1qONeBFm5eICUkdrPU01oPEBpO9LfEm3H4UMPcjk Gh8aCOFQmXYgWTK9C3szxe8FBx3FD4adcQv3r/EK1EutUgpj2nRkaKS0SfkrH2saopFu 59xvlpCI8tN7SX7PAAX6LL2gNYx8HkcK8R2Pp/6+htlNTd7TJ++C9nRA3P6U1kbZJgcI JLZr1I9Nm7rNA+aOkA8AT4zsh8/RrIhT9uYQwFqkGp0L8OlIYHlHdie3A3NPo+wTw5Qs FjMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tRCCBm3AzTzCNy+BqzMJL8FUACZISPHyT9rqHUf0wkE=; b=bbzpEesG37Ox1F04wUyFXjzVCA2yfJOoBX2l24WktBwLNJis1YCxMuniQAOUrmlJf+ pWHpxcoawWS6imDQ73sQuS1/fVUD2C5ZGEzY6eEXzRd0tSQS4Q6kNdxcsqF8MsjrJGEC nurPEQmuklLb63ZkZjkN92Yr3pF+62zn77xsp0k9o6z5pT5/Eb+b/niRwEBjJ+DUMmXd oW3QQ/oFlGzVISPam3Dr91VxRZgTlAjs7b4DAb36xS/ljF7CDyskwjxM5k5VYNfLIkwQ Kb0VH4QdIUvVAvE9nm5lERricAsyzuAlcu8QaQ2QHDcKacDZ0DQ2JTF+uqxCEaEaywbx ++jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SJTrn3Br; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id n14-20020a17090ac68e00b001e3022c3e0bsi29132088pjt.30.2022.06.07.22.42.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:42:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SJTrn3Br; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8C224304B7F; Tue, 7 Jun 2022 22:07:46 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382357AbiFGVvP (ORCPT + 99 others); Tue, 7 Jun 2022 17:51:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378195AbiFGUzl (ORCPT ); Tue, 7 Jun 2022 16:55:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 951C91E1758; Tue, 7 Jun 2022 11:44:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C501DB8237F; Tue, 7 Jun 2022 18:44:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40C3EC385A2; Tue, 7 Jun 2022 18:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627452; bh=xhwKDY0+F7XerJFPHVZJ/ecf6Vn4nsvoLVtrRM3144o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJTrn3BrAayToj+j8iXh36uAHsd3QQg1XYGZCn1as59vGlxqBVgmu7xH74IUwR5SG uZDCcfWJ+/k1qpzw+wEAjCzDj4NrrhSb8hSv2AGipwzXwIMM81j2OvA7WhY0XiNcAO w2IpVrxEUdjfqdnnsiCdxdQ6EKDehtRGrw7gUBrE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Lu=C3=ADs=20Henriques?= , Jeff Layton , Ilya Dryomov Subject: [PATCH 5.17 746/772] ceph: fix decoding of client session messages flags Date: Tue, 7 Jun 2022 19:05:38 +0200 Message-Id: <20220607165011.012168594@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luís Henriques commit ea16567f11018e2f58e72b667b0c803ff92b8153 upstream. The cephfs kernel client started to show the message: ceph: mds0 session blocklisted when mounting a filesystem. This is due to the fact that the session messages are being incorrectly decoded: the skip needs to take into account the 'len'. While there, fixed some whitespaces too. Cc: stable@vger.kernel.org Fixes: e1c9788cb397 ("ceph: don't rely on error_string to validate blocklisted session.") Signed-off-by: Luís Henriques Reviewed-by: Jeff Layton Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- fs/ceph/mds_client.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -3378,13 +3378,17 @@ static void handle_session(struct ceph_m } if (msg_version >= 5) { - u32 flags; - /* version >= 4, struct_v, struct_cv, len, metric_spec */ - ceph_decode_skip_n(&p, end, 2 + sizeof(u32) * 2, bad); + u32 flags, len; + + /* version >= 4 */ + ceph_decode_skip_16(&p, end, bad); /* struct_v, struct_cv */ + ceph_decode_32_safe(&p, end, len, bad); /* len */ + ceph_decode_skip_n(&p, end, len, bad); /* metric_spec */ + /* version >= 5, flags */ - ceph_decode_32_safe(&p, end, flags, bad); + ceph_decode_32_safe(&p, end, flags, bad); if (flags & CEPH_SESSION_BLOCKLISTED) { - pr_warn("mds%d session blocklisted\n", session->s_mds); + pr_warn("mds%d session blocklisted\n", session->s_mds); blocklisted = true; } }