[2.4.5]Patch - fix page leak in nfs_prepare_write()

Trond Myklebust (trond.myklebust@fys.uio.no)
Sat, 23 Jun 2001 01:53:20 +0200


Hi,

The following patch fixes a leak in high memory in case a
process is signalled while in nfs_prepare_write().

Cheers,
Trond

diff -u --recursive --new-file linux-2.4.6-mmap/fs/nfs/file.c linux-2.4.6-file/fs/nfs/file.c
--- linux-2.4.6-mmap/fs/nfs/file.c Tue May 22 18:26:06 2001
+++ linux-2.4.6-file/fs/nfs/file.c Fri Jun 22 18:43:34 2001
@@ -162,9 +162,18 @@
*/
static int nfs_prepare_write(struct file *file, struct page *page, unsigned offset, unsigned to)
{
+ int status;
+
kmap(page);
- return nfs_flush_incompatible(file, page);
+ status = nfs_flush_incompatible(file, page);
+ if (status)
+ goto out_err;
+ return 0;
+ out_err:
+ kunmap(page);
+ return status;
}
+
static int nfs_commit_write(struct file *file, struct page *page, unsigned offset, unsigned to)
{
long status;
-
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/