Skip to contentSkip to conversation

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

PATCH Trond Myklebust 1 participant 1 message Jun 22, 2001 NFS client

lore
Share & tools
lore
#0 lore raw

Hi,

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

Cheers,
Trond

fs/nfs/file.c +10 -1
diff -u --recursive --new-file linux-2.4.6-mmap/fs/nfs/file.c linux-2.4.6-file/fs/nfs/file.c
@@ -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;