From patchwork Tue Mar 22 21:40:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaliy Gusev X-Patchwork-Id: 653641 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 p2MLqHlM010617 for ; Tue, 22 Mar 2011 21:52:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932350Ab1CVVwQ (ORCPT ); Tue, 22 Mar 2011 17:52:16 -0400 Received: from relay03.bluemeaney.com ([205.234.16.187]:47199 "EHLO relay03.bluemeaney.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755479Ab1CVVwP (ORCPT ); Tue, 22 Mar 2011 17:52:15 -0400 X-ASG-Debug-ID: 1300830070-25ab95920001-suBQlS Received: from sfdc-fe01.bluemeaney.com ([172.28.16.33]) by relay03.bluemeaney.com with ESMTP id ViHteZBPeMT72fhx; Tue, 22 Mar 2011 14:41:10 -0700 (PDT) X-Barracuda-Envelope-From: Gusev.Vitaliy@nexenta.com X-ASG-Whitelist: Client Received: from vT510 ([172.28.16.12]) by sfdc-fe01.bluemeaney.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 22 Mar 2011 14:41:08 -0700 From: Vitaliy Gusev X-Barracuda-BBL-IP: 172.28.16.12 X-Barracuda-RBL-IP: 172.28.16.12 To: Trond Myklebust Cc: linux-nfs@vger.kernel.org, Al Viro , linux-fsdevel , Gusev Vitaliy Subject: [PATCH] nfs4: Fix NULL dereference at d_alloc_and_lookup() Date: Wed, 23 Mar 2011 00:40:25 +0300 X-ASG-Orig-Subj: [PATCH] nfs4: Fix NULL dereference at d_alloc_and_lookup() Message-Id: <1300830025-17152-1-git-send-email-gusev.vitaliy@nexenta.com> X-Mailer: git-send-email 1.7.1 X-OriginalArrivalTime: 22 Mar 2011 21:41:09.0493 (UTC) FILETIME=[DB4C0250:01CBE8D9] X-Barracuda-Connect: UNKNOWN[172.28.16.33] X-Barracuda-Start-Time: 1300830070 X-Barracuda-URL: http://spam.bluemeaney.com:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at bluemeaney.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.6 (demeter1.kernel.org [140.211.167.41]); Tue, 22 Mar 2011 21:52:19 +0000 (UTC) diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 3031ef7..914eb78 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c @@ -192,6 +192,10 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh) goto out; } + if (fattr->valid & NFS_ATTR_FATTR_FSID && + !nfs_fsid_equal(&server->fsid, &fattr->fsid)) + memcpy(&server->fsid, &fattr->fsid, sizeof(server->fsid)); + inode = nfs_fhget(sb, mntfh, fattr); if (IS_ERR(inode)) { dprintk("nfs_get_root: get root inode failed\n");