瀏覽代碼

knfsd: nfs4 name->id mapping not correctly parsing negative downcall

Note that qword_get() returns length or -1, not an -ERROR.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Acked-by:  Neil Brown <neilb@suse.de>
J. Bruce Fields 18 年之前
父節點
當前提交
c9b6cbe56d
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      fs/nfsd/nfs4idmap.c

+ 5 - 3
fs/nfsd/nfs4idmap.c

@@ -207,6 +207,7 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
 {
 {
 	struct ent ent, *res;
 	struct ent ent, *res;
 	char *buf1, *bp;
 	char *buf1, *bp;
+	int len;
 	int error = -EINVAL;
 	int error = -EINVAL;
 
 
 	if (buf[buflen - 1] != '\n')
 	if (buf[buflen - 1] != '\n')
@@ -248,10 +249,11 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
 		goto out;
 		goto out;
 
 
 	/* Name */
 	/* Name */
-	error = qword_get(&buf, buf1, PAGE_SIZE);
-	if (error == -EINVAL)
+	error = -EINVAL;
+	len = qword_get(&buf, buf1, PAGE_SIZE);
+	if (len < 0)
 		goto out;
 		goto out;
-	if (error == -ENOENT)
+	if (len == 0)
 		set_bit(CACHE_NEGATIVE, &ent.h.flags);
 		set_bit(CACHE_NEGATIVE, &ent.h.flags);
 	else {
 	else {
 		if (error >= IDMAP_NAMESZ) {
 		if (error >= IDMAP_NAMESZ) {