提交 49e73720 编写于 作者: J J. Bruce Fields

nfsd: fh_update should error out in unexpected cases

The reporter saw a NULL dereference when a filesystem's ->mknod returned
success but left the dentry negative, and then nfsd tried to dereference
d_inode (in this case because the CREATE was followed by a GETATTR in
the same nfsv4 compound).

fh_update already checks for this and another broken case, but for some
reason it returns success and leaves nfsd trying to soldier on.  If it
failed we'd avoid the crash.  There's only so much we can do with a
buggy filesystem, but it's easy enough to bail out here, so let's do
that.
Reported-by: NAntti Tönkyrä <daedalus@pingtimeout.net>
Tested-by: NAntti Tönkyrä <daedalus@pingtimeout.net>
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
上级 956c4fee
...@@ -598,22 +598,20 @@ fh_update(struct svc_fh *fhp) ...@@ -598,22 +598,20 @@ fh_update(struct svc_fh *fhp)
_fh_update_old(dentry, fhp->fh_export, &fhp->fh_handle); _fh_update_old(dentry, fhp->fh_export, &fhp->fh_handle);
} else { } else {
if (fhp->fh_handle.fh_fileid_type != FILEID_ROOT) if (fhp->fh_handle.fh_fileid_type != FILEID_ROOT)
goto out; return 0;
_fh_update(fhp, fhp->fh_export, dentry); _fh_update(fhp, fhp->fh_export, dentry);
if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID)
return nfserr_opnotsupp; return nfserr_opnotsupp;
} }
out:
return 0; return 0;
out_bad: out_bad:
printk(KERN_ERR "fh_update: fh not verified!\n"); printk(KERN_ERR "fh_update: fh not verified!\n");
goto out; return nfserr_serverfault;
out_negative: out_negative:
printk(KERN_ERR "fh_update: %pd2 still negative!\n", printk(KERN_ERR "fh_update: %pd2 still negative!\n",
dentry); dentry);
goto out; return nfserr_serverfault;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册