From patchwork Thu Dec 23 23:54:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fred Isaman X-Patchwork-Id: 431131 X-Patchwork-Delegate: Trond.Myklebust@netapp.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBNNspN4025828 for ; Thu, 23 Dec 2010 23:54:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752030Ab0LWXyy (ORCPT ); Thu, 23 Dec 2010 18:54:54 -0500 Received: from mx2.netapp.com ([216.240.18.37]:50984 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751957Ab0LWXyw (ORCPT ); Thu, 23 Dec 2010 18:54:52 -0500 X-IronPort-AV: E=Sophos;i="4.60,220,1291622400"; d="scan'208";a="498475003" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 23 Dec 2010 15:54:52 -0800 Received: from localhost.localdomain (vpn2ntap-107102.hq.netapp.com [10.58.56.182]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id oBNNsiit009323; Thu, 23 Dec 2010 15:54:51 -0800 (PST) From: Fred Isaman To: linux-nfs@vger.kernel.org Cc: Trond Myklebust Subject: [PATCH 10/15] pnfs: check that partial LAYOUTGET return is ignored Date: Thu, 23 Dec 2010 18:54:36 -0500 Message-Id: <1293148481-28420-11-git-send-email-iisaman@netapp.com> X-Mailer: git-send-email 1.7.2.1 In-Reply-To: <1293148481-28420-1-git-send-email-iisaman@netapp.com> References: <1293148481-28420-1-git-send-email-iisaman@netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 23 Dec 2010 23:54:56 +0000 (UTC) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index c00b673..cd99064 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -660,6 +660,17 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) struct inode *ino = lo->plh_inode; int status = 0; + /* Verify we got what we asked for. + * Note that because the xdr parsing only accepts a single + * element array, this can fail even if the server is behaving + * correctly. + */ + if (lgp->args.range.iomode > res->range.iomode || + res->range.offset != 0 || + res->range.length != NFS4_MAX_UINT64) { + status = -EINVAL; + goto out; + } /* Inject layout blob into I/O device driver */ lseg = NFS_SERVER(ino)->pnfs_curr_ld->alloc_lseg(lo, res); if (!lseg || IS_ERR(lseg)) {