[PATCH] bugfix nfs kmap_atomic (fwd)

From: Rik van Riel (riel@surriel.com)
Date: Fri Apr 11 2003 - 13:59:00 EST


Oops, wrong address at first ;)

---------- Forwarded message ----------
Date: Fri, 11 Apr 2003 14:44:28 -0400 (EDT)
From: Rik van Riel <riel@surriel.com>
Subject: [PATCH] bugfix nfs kmap_atomic

There's a serious bug in the handling of the pointer returned
by kmap_atomic() in nfs/dir.c. The pointer (part of desc) is
passed into find_dirent_name and from there into dir_decode,
which modifies the pointer.

That means you end up passing a wrong address to kunmap_atomic().
The patch below fixes it by remembering the address that kmap_atomic()
told us.

Please apply. Thank you,

Rik

===== fs/nfs/dir.c 1.53 vs edited =====
--- 1.53/fs/nfs/dir.c Mon Apr 7 18:22:57 2003
+++ edited/fs/nfs/dir.c Fri Apr 11 14:40:39 2003
@@ -714,6 +714,7 @@
         struct nfs_server *server;
         struct nfs_entry entry;
         struct page *page;
+ void * kaddr;
         unsigned long timestamp = NFS_MTIME_UPDATE(dir);
         int res;
 
@@ -736,9 +737,9 @@
 
                 res = -EIO;
                 if (PageUptodate(page)) {
- desc.ptr = kmap_atomic(page, KM_USER0);
+ kaddr = desc.ptr = kmap_atomic(page, KM_USER0);
                         res = find_dirent_name(&desc, page, dentry);
- kunmap_atomic(desc.ptr, KM_USER0);
+ kunmap_atomic(kaddr, KM_USER0);
                 }
                 page_cache_release(page);
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Apr 15 2003 - 22:00:24 EST