Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5881660pxb; Mon, 14 Feb 2022 09:42:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDT/KRKODZScc/6ID4f9KgO4/yyg2q5EtAoy+vNngoozoWJDlj716j1Sqj2XS09hDQcTue X-Received: by 2002:a05:6402:3714:: with SMTP id ek20mr813809edb.16.1644860548175; Mon, 14 Feb 2022 09:42:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644860548; cv=none; d=google.com; s=arc-20160816; b=QmhvDXMPU1wXgCyh91XM32ZRmbBRfAIsFEVVJm1Pzhq8fHzKpjksqGbzl1KaNsuM/S XyNCT2Z1anxEapnt3gGbEk5j2r1Rk4wROXmyfTz9LMmvJrwn1UnJNJ0cYtnyWGDUUp2n zHf5j3JY41X1EGPnC2DhJE6fihNM3bN0CSsmUVMS1vvDonFMflbt1c9+Mb4OXVPyDmCS UnQ49zAlRTRE4WSIQzkIogTyKUqaxUlFJHB79MvGqe5o5vq2eblEHt2Zih2r5WVx0fbX QxCbD5StZHiAZf5Gjk7bijy1a0WKorYA/e9+ijvxGYEIUcXzVWL9774kKmWXu5FoiRp4 4wDQ== 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=nWLVSAVMbm1PHU1xx0m8QYqHjVsJ4LC8xgyCHnw2pc0=; b=DxZFrfQ4YstPT6Ri/8GhQwO+ue7IOZ2+yzziW7Gp/TKnc3t4+LMZcNQDyXMngcXLbO JEwm007fne88lCBD2yvMNJEVmveS6JbUmXg9jHob4U8BwR1MLAdoZzmzm0TFII5FD1Ry Zgk3pd9yBfDae9UJ5YrMa0YrZmjHzQ0sTIt1E+Tv/OJzKlE5knQyDlbwa/7ve25wEl3C aSaP3AWf1seE5Ssx1QQfgj3y5QehoBSPsd2xrWIfE5OPFrXP4Odyd5XAhraUp+4iGicC cCnH8tbkuYLwGjxjnAW1nMszXHPlhS5gIaxCIIHU6+j1gy3f3kB4XL1ScuXHM9v7e4E3 Uw9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DMZW5H9H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l4si5147411ejo.195.2022.02.14.09.42.04; Mon, 14 Feb 2022 09:42:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DMZW5H9H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245281AbiBNJsO (ORCPT + 99 others); Mon, 14 Feb 2022 04:48:14 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245576AbiBNJqA (ORCPT ); Mon, 14 Feb 2022 04:46:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 331AF71794; Mon, 14 Feb 2022 01:39:10 -0800 (PST) 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 933CFB80DC4; Mon, 14 Feb 2022 09:39:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCBF7C340E9; Mon, 14 Feb 2022 09:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831548; bh=zfKL74C9P9xxo2vZoT+VWgv6AeaT2EL9L1gQ53CIxTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMZW5H9Haweb5vzSvwRwnQ0jnQo3tpPCdEeSscygCeOet89EN/pSwc7fu2LOE2FQ0 Xr9TQy6V/zcBpMHCFQuiIYUrW2FLRP3MuYNySDjAn5tnIcCRPm1ZzXawKGnAh8NoGK ZfksAnLO/f1sd0QTOtyqdZGkyYtC2P57mqY04YK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Anna Schumaker , Sasha Levin Subject: [PATCH 5.10 018/116] NFSv4 remove zero number of fs_locations entries error check Date: Mon, 14 Feb 2022 10:25:17 +0100 Message-Id: <20220214092459.310715478@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092458.668376521@linuxfoundation.org> References: <20220214092458.668376521@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=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Olga Kornievskaia [ Upstream commit 90e12a3191040bd3854d3e236c35921e4e92a044 ] Remove the check for the zero length fs_locations reply in the xdr decoding, and instead check for that in the migration code. Signed-off-by: Olga Kornievskaia Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/nfs4state.c | 3 +++ fs/nfs/nfs4xdr.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 4bf10792cb5b1..cbeec29e9f21a 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -2104,6 +2104,9 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred } result = -NFS4ERR_NXIO; + if (!locations->nlocations) + goto out; + if (!(locations->fattr.valid & NFS_ATTR_FATTR_V4_LOCATIONS)) { dprintk("<-- %s: No fs_locations data, migration skipped\n", __func__); diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 9f8bd45379e72..e2f0e3446e22a 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -3680,8 +3680,6 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st if (unlikely(!p)) goto out_eio; n = be32_to_cpup(p); - if (n <= 0) - goto out_eio; for (res->nlocations = 0; res->nlocations < n; res->nlocations++) { u32 m; struct nfs4_fs_location *loc; -- 2.34.1