Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2816018ybg; Mon, 28 Oct 2019 02:54:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIquHVtTBvjRSzehdzQPl5w0fWGrsxiIXFU/qHN2ZQEhx6S4LamWsY/Jy9Mvx7FUAbLqGe X-Received: by 2002:a17:906:2458:: with SMTP id a24mr5793614ejb.139.1572256484537; Mon, 28 Oct 2019 02:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572256484; cv=none; d=google.com; s=arc-20160816; b=K1c4PtABWJYfwzp38c1sO18xAGnIPcML5hr7KyRVUy32aYaDj5qfE9BWB1y/jB+8A5 DoReaFCbdT43Vw0D0hbRRRJlzgxc/g4MaOJPURmNt/zWdSyChVicCzN2A/RWpiCK70I8 2Bb92XLYUN1E8AVPHTOXDwrNOb4oO6ojzSL4fWAaFuaaZTDSUzARjrHVa94izzTxylV+ TtJte3iby1FGV52o4Pe99DE6Aop6/Z2NGPB2SiBgNXG2bZagmtZxu380nii1xZMdR6z5 YemxQ6ZY69omcweJfiyjIRK6Sj6RXFk+9JjOH0A2y9yqULrf9QNjXuUF5zsYTgh+9XGe Swqw== 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=daKqwdNntO2QwOvwk1XDDN4L6varMZWrQ8k/UV0vO8w=; b=GZS/lID9O4+qbJ73F2lRAmU2aLiSD5xYcCkBic3aY9KfaVhpp5663F9pSJTrIdRkXq Urx213jqqyEkKAbuijqpWa1SNwnGme4hck/8ag+dNFULowj6TPZvvmAiGUM5qZOghhXU 7RyxMpPNuP09lSAxeUepRfALjYN7lwT/hSy2VcEcJx0rl07Gq4G5lBiHU0ff4MbDfUt3 lY/tONAsLekAo/4dK/0BSYTwQmcY6Y9EoKz4ZthjE3sg7Ql2zEThmILDg2r5fJ9/0qFx gF8Xl9eySJyQxDtFz1V7yJ9kyVJ+BW+Z+PG/gswocRF8fNU2S0Sj1kITgaU9sbbyVzaI YDVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nh72g7yj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jr14si2701575ejb.316.2019.10.28.02.54.15; Mon, 28 Oct 2019 02:54:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nh72g7yj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732810AbfJ0VZw (ORCPT + 99 others); Sun, 27 Oct 2019 17:25:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:47718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732799AbfJ0VZs (ORCPT ); Sun, 27 Oct 2019 17:25:48 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (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 A418B21850; Sun, 27 Oct 2019 21:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572211548; bh=xKVZE5JhxPls7RCkz1IZ18bRsS/CieIGVS88fy3Y+K0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nh72g7yjcpEViTLX+HpKRSucFb5Cc88W4rU4tUbh8CIMHDkmrEnH6fx4tR4bIBor9 +mLRPozdVSqHy9/6GcGG7UwZadH6hzeCj2xioXSR3rHkh1V7k1oLCBP4ctMmuWgHbu jgfVSzfwnsGSIQ6t/f81LGp6HknbYp3uu6y8CmNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , Ilya Dryomov Subject: [PATCH 5.3 191/197] ceph: just skip unrecognized info in ceph_reply_info_extra Date: Sun, 27 Oct 2019 22:01:49 +0100 Message-Id: <20191027203406.798811216@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203351.684916567@linuxfoundation.org> References: <20191027203351.684916567@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 1d3f87233e26362fc3d4e59f0f31a71b570f90b9 upstream. In the future, we're going to want to extend the ceph_reply_info_extra for create replies. Currently though, the kernel code doesn't accept an extra blob that is larger than the expected data. Change the code to skip over any unrecognized fields at the end of the extra blob, rather than returning -EIO. Cc: stable@vger.kernel.org Signed-off-by: Jeff Layton Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- fs/ceph/mds_client.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -384,8 +384,8 @@ static int parse_reply_info_readdir(void } done: - if (*p != end) - goto bad; + /* Skip over any unrecognized fields */ + *p = end; return 0; bad: @@ -406,12 +406,10 @@ static int parse_reply_info_filelock(voi goto bad; info->filelock_reply = *p; - *p += sizeof(*info->filelock_reply); - if (unlikely(*p != end)) - goto bad; + /* Skip over any unrecognized fields */ + *p = end; return 0; - bad: return -EIO; } @@ -425,18 +423,21 @@ static int parse_reply_info_create(void { if (features == (u64)-1 || (features & CEPH_FEATURE_REPLY_CREATE_INODE)) { + /* Malformed reply? */ if (*p == end) { info->has_create_ino = false; } else { info->has_create_ino = true; - info->ino = ceph_decode_64(p); + ceph_decode_64_safe(p, end, info->ino, bad); } + } else { + if (*p != end) + goto bad; } - if (unlikely(*p != end)) - goto bad; + /* Skip over any unrecognized fields */ + *p = end; return 0; - bad: return -EIO; }