Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2277689iof; Wed, 8 Jun 2022 01:12:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZxb4SfHSGzccFaXiD1U433uhEoCw/0ESZfD8KxAeLlANTJO41QSyIolcgks7rZ/odfi98 X-Received: by 2002:a17:902:cf06:b0:163:62cb:250e with SMTP id i6-20020a170902cf0600b0016362cb250emr33157067plg.171.1654675931487; Wed, 08 Jun 2022 01:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654675931; cv=none; d=google.com; s=arc-20160816; b=zg4Zi4taTaHguAEGkZtF/MyWVtkGtTgg4Ixjxl9+3z5n+3qHSXJSuMkV4VNlh1Ixek qxqhllDLzeyUb/4aPUwSuYA6IteBci/NTjwJtQ1lRYsz03Pr32B+wgOZ3xpReK7iX0VY L9qRtmpmuyw2t8Co4PJPYzkS4Gm4uC674BMEUqU+SKF8oMz2LQTgXk9s6yqTV5Usfj0c N2f1+p8SAjIIvJgg+N0knWhn5cUwLG03kRqrb8FAh9K0ONgAb65BNl8Jd5NPdhB+L0ND bGaJZWSw8CUnlpfuSLOO2WJW6I1r74aX0VUES2MscVWkj0gncUsV0T79nLMYmoL9pTqz Zcsg== 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=ynXSrbG0roaDcLwec18UsJ+2lE0530Xs/i3gKjf2KCM=; b=nJrljebDpN4g6rvS9zFQm9p3q5qSAJfZrlFYaWGRxTWGT791J0oSMD2+ULhCFfsUVY FtxuyXIYH6WulzmpM2Yos++LPtO/GEtY4QmgadMvjKvPpquZiFIZNclvbxed9a0wiVju VU7J/+LySbS8RVvf9ij81Gkch6ojc8ipk3LJhsg8Hu2fMPwI2MYrqyKYaoCFPtsbS0ts /IcbxttqP+ZmZf+COOc2zhNIbNGOkAXHZ3tcGS3itgJBfGwIXdmp2uXTPBroA4PU4mJc vA/Dp+3Q08WmWf8iG/UXCVVqqkAa7UUcM3tjyXoFEmS6NuUu05lDVv8NH9oQuvsWq2UQ 2DMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w1nqYV1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x5-20020a1709028ec500b001624625418dsi141955plo.597.2022.06.08.01.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:12:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=w1nqYV1d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 BC837323424; Wed, 8 Jun 2022 00:43:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442077AbiFHB7X (ORCPT + 99 others); Tue, 7 Jun 2022 21:59:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1836564AbiFGX60 (ORCPT ); Tue, 7 Jun 2022 19:58:26 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C63A27CCE7; Tue, 7 Jun 2022 12:26:09 -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 sin.source.kernel.org (Postfix) with ESMTPS id 38497CE24B5; Tue, 7 Jun 2022 19:26:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24CB6C34115; Tue, 7 Jun 2022 19:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629965; bh=i7uedHnmYzoe8nCdpJv4iFGblLZxY6c0LsUFeH9uEvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w1nqYV1dDKl4AkMqtNWtxQbGxIKlM5qFvfOGSHz77HA5oCeE+mZ6vDicJ9OSeAJL9 jpSjdmuGCz75Ai4fAL/ixMmP2BVIAfbJYt+boOCEkhEZHqAzq4AbOA4zY9x9vSDRXI 06qRGZpiyYoPGnbytWsG21rOb1aP2PyCZ+n2JIeU= 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.18 852/879] ceph: fix decoding of client session messages flags Date: Tue, 7 Jun 2022 19:06:10 +0200 Message-Id: <20220607165027.585511848@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 @@ -3375,13 +3375,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; } }