Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1248785pxa; Thu, 20 Aug 2020 06:44:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeOHTavsMNbBbskNEx2LZpd38khIHA58j9v8jc9fCo50/ZZS72s2+rwWS+6ELnv/RfS0EC X-Received: by 2002:aa7:ce0b:: with SMTP id d11mr2834654edv.357.1597931055313; Thu, 20 Aug 2020 06:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597931055; cv=none; d=google.com; s=arc-20160816; b=aVOkQenfewMLG8SUeHElTVApTJZlL1e7B9qmJlVRnwJZGbQh5+800rNTLODbhWsakK 0m7exIM6TxbCK/yPIkP2MJ0ySZKTksJijwQsgSkzwgt44e2fxlvAXUNiLV2otWjXcnWw ddqFKVlJjumT4OADsoVPNGs+FXLVYsXAv/0cJZT6Q5f0Cf9dwiCdj3Yd1xgY3RNqpowK VCz2ocq52p9ms80fQApOut+Be2G56Q1+/OGSL0QPXXlPObij5xV63pL0iNrC6fTgrufK vG3BN2V16OGwZNsrRolL7IUCMhu7Dut75smx/eyWofI5/VeFSEewkkh+FuYtmdswVGf9 TlKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=68qeEvJHu0U4xO3Dq2mi5OrTGem/IW/S2gSFVFKPqR4=; b=QP+cNemw2MijHUEgX3lsItY8DdEhPpZqBdc1abGvBy5aLsLGhbVzSmttfbZOazZHvR 3Dg6qh9PcGZvj19kF8oDU0/csC1NcqYm44irfR1p2T0CVZABPBZY4RG2otSHxET1vQt/ E2zreBDeEZS+gtufGV+TL0JkjSLfV7+4IiwZg7ufjl4jWxccuC0cj7Kr85kjs6FAoeSj 78ANGMwSnB/+R1mrmZc0e6/1eGo6m9yWmwNgAqyu/M2V0rWZaKxtKHugdDGb8V7K/of5 uhzY+ZftouoOMe2se31IifB+UB7sX6kJ62/CqARYwLWyzUYPbpLaskBcXm7ow3Nt6byB vOhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=doa3yl6M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si1230754ejy.326.2020.08.20.06.43.50; Thu, 20 Aug 2020 06:44:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=doa3yl6M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730860AbgHTNm4 (ORCPT + 99 others); Thu, 20 Aug 2020 09:42:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:39866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727854AbgHTJ3X (ORCPT ); Thu, 20 Aug 2020 05:29:23 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6AC4E22D07; Thu, 20 Aug 2020 09:29:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915763; bh=8gTAWMHmKWWQ19Ho78or6u9zEjW6IwLD3rcYFIbm1AE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=doa3yl6MGZaQMt3UjWA6XQZWX8IplGmV/xcdJtB0EwpJ6uESWbTBvEmGmIk2wTIIJ fzikcVO3oyFIuWcrrGmWcuh2QjZnHYZr4ocL+0V/BofEN5kCrxxBYlVKsPXtrU0NAN /JDkzYBtDADVcrfhxcjQDOCMpce/SYqJbHiI5Q3E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Ilya Dryomov , Patrick Donnelly Subject: [PATCH 5.8 096/232] ceph: handle zero-length feature mask in session messages Date: Thu, 20 Aug 2020 11:19:07 +0200 Message-Id: <20200820091617.478856293@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeff Layton commit 02e37571f9e79022498fd0525c073b07e9d9ac69 upstream. Most session messages contain a feature mask, but the MDS will routinely send a REJECT message with one that is zero-length. Commit 0fa8263367db ("ceph: fix endianness bug when handling MDS session feature bits") fixed the decoding of the feature mask, but failed to account for the MDS sending a zero-length feature mask. This causes REJECT message decoding to fail. Skip trying to decode a feature mask if the word count is zero. Cc: stable@vger.kernel.org URL: https://tracker.ceph.com/issues/46823 Fixes: 0fa8263367db ("ceph: fix endianness bug when handling MDS session feature bits") Signed-off-by: Jeff Layton Reviewed-by: Ilya Dryomov Tested-by: Patrick Donnelly Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- fs/ceph/mds_client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -3279,8 +3279,10 @@ static void handle_session(struct ceph_m goto bad; /* version >= 3, feature bits */ ceph_decode_32_safe(&p, end, len, bad); - ceph_decode_64_safe(&p, end, features, bad); - p += len - sizeof(features); + if (len) { + ceph_decode_64_safe(&p, end, features, bad); + p += len - sizeof(features); + } } mutex_lock(&mdsc->mutex);