From patchwork Wed Oct 3 00:18:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 1539991 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 64587DFFAD for ; Wed, 3 Oct 2012 00:18:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932885Ab2JCAS3 (ORCPT ); Tue, 2 Oct 2012 20:18:29 -0400 Received: from mx2.netapp.com ([216.240.18.37]:8246 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932882Ab2JCAS1 (ORCPT ); Tue, 2 Oct 2012 20:18:27 -0400 X-IronPort-AV: E=Sophos;i="4.80,525,1344236400"; d="scan'208";a="696730518" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 02 Oct 2012 17:18:26 -0700 Received: from lade.trondhjem.org.localdomain ([10.55.16.63]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q930IPk3007813; Tue, 2 Oct 2012 17:18:26 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 5/5] NFSv4: nfs4_open_done first must check that GETATTR decoded a file type Date: Tue, 2 Oct 2012 17:18:25 -0700 Message-Id: <1349223505-59248-5-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1349223505-59248-4-git-send-email-Trond.Myklebust@netapp.com> References: <1349223505-59248-1-git-send-email-Trond.Myklebust@netapp.com> <1349223505-59248-2-git-send-email-Trond.Myklebust@netapp.com> <1349223505-59248-3-git-send-email-Trond.Myklebust@netapp.com> <1349223505-59248-4-git-send-email-Trond.Myklebust@netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org ...before it can check the validity of that file type. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 21cfac7..68438aa 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1537,7 +1537,8 @@ static void nfs4_open_done(struct rpc_task *task, void *calldata) return; if (task->tk_status == 0) { - switch (data->o_res.f_attr->mode & S_IFMT) { + if (data->o_res.f_attr->valid & NFS_ATTR_FATTR_TYPE) { + switch (data->o_res.f_attr->mode & S_IFMT) { case S_IFREG: break; case S_IFLNK: @@ -1548,6 +1549,7 @@ static void nfs4_open_done(struct rpc_task *task, void *calldata) break; default: data->rpc_status = -ENOTDIR; + } } renew_lease(data->o_res.server, data->timestamp); if (!(data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM))