mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [2.4.5]Patch - fix page leak in nfs_prepare_write()
@ 2001-06-22 23:53 Trond Myklebust
  0 siblings, 0 replies; only message in thread
From: Trond Myklebust @ 2001-06-22 23:53 UTC (permalink / raw)
  To: Alan Cox, Linus Torvalds; +Cc: Linux Kernel, NFS maillist


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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-22 23:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-22 23:53 [2.4.5]Patch - fix page leak in nfs_prepare_write() Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®