[kernel/f15] Add patch to fix fuse memory leak (rhbz 745241)

Josh Boyer jwboyer at fedoraproject.org
Tue Oct 11 19:05:09 UTC 2011


commit 38f975149b16c38977058be7c59401701a7b2b8e
Author: Josh Boyer <jwboyer at redhat.com>
Date:   Tue Oct 11 15:04:39 2011 -0400

    Add patch to fix fuse memory leak (rhbz 745241)

 fuse-fix-memory-leak.patch |   70 ++++++++++++++++++++++++++++++++++++++++++++
 kernel.spec                |   11 ++++++-
 2 files changed, 80 insertions(+), 1 deletions(-)
---
diff --git a/fuse-fix-memory-leak.patch b/fuse-fix-memory-leak.patch
new file mode 100644
index 0000000..c52069b
--- /dev/null
+++ b/fuse-fix-memory-leak.patch
@@ -0,0 +1,70 @@
+From 4078129ec09990936702ab5274e05d139d7f7dcd Mon Sep 17 00:00:00 2001
+From: Miklos Szeredi <mszeredi at suse.cz>
+Date: Mon, 12 Sep 2011 09:38:03 +0200
+Subject: [PATCH] fuse: fix memory leak
+
+kmemleak is reporting that 32 bytes are being leaked by FUSE:
+
+  unreferenced object 0xe373b270 (size 32):
+  comm "fusermount", pid 1207, jiffies 4294707026 (age 2675.187s)
+  hex dump (first 32 bytes):
+    01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  ................
+    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  backtrace:
+    [<b05517d7>] kmemleak_alloc+0x27/0x50
+    [<b0196435>] kmem_cache_alloc+0xc5/0x180
+    [<b02455be>] fuse_alloc_forget+0x1e/0x20
+    [<b0245670>] fuse_alloc_inode+0xb0/0xd0
+    [<b01b1a8c>] alloc_inode+0x1c/0x80
+    [<b01b290f>] iget5_locked+0x8f/0x1a0
+    [<b0246022>] fuse_iget+0x72/0x1a0
+    [<b02461da>] fuse_get_root_inode+0x8a/0x90
+    [<b02465cf>] fuse_fill_super+0x3ef/0x590
+    [<b019e56f>] mount_nodev+0x3f/0x90
+    [<b0244e95>] fuse_mount+0x15/0x20
+    [<b019d1bc>] mount_fs+0x1c/0xc0
+    [<b01b5811>] vfs_kern_mount+0x41/0x90
+    [<b01b5af9>] do_kern_mount+0x39/0xd0
+    [<b01b7585>] do_mount+0x2e5/0x660
+    [<b01b7966>] sys_mount+0x66/0xa0
+
+This leak report is consistent and happens once per boot on
+3.1.0-rc5-dirty.
+
+This happens if a FORGET request is queued after the fuse device was
+released.
+
+Reported-by: Sitsofe Wheeler <sitsofe at yahoo.com>
+Signed-off-by: Miklos Szeredi <mszeredi at suse.cz>
+Tested-by: Sitsofe Wheeler <sitsofe at yahoo.com>
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ fs/fuse/dev.c |   12 ++++++++----
+ 1 files changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
+index 168a80f..5cb8614 100644
+--- a/fs/fuse/dev.c
++++ b/fs/fuse/dev.c
+@@ -258,10 +258,14 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
+ 	forget->forget_one.nlookup = nlookup;
+ 
+ 	spin_lock(&fc->lock);
+-	fc->forget_list_tail->next = forget;
+-	fc->forget_list_tail = forget;
+-	wake_up(&fc->waitq);
+-	kill_fasync(&fc->fasync, SIGIO, POLL_IN);
++	if (fc->connected) {
++		fc->forget_list_tail->next = forget;
++		fc->forget_list_tail = forget;
++		wake_up(&fc->waitq);
++		kill_fasync(&fc->fasync, SIGIO, POLL_IN);
++	} else {
++		kfree(forget);
++	}
+ 	spin_unlock(&fc->lock);
+ }
+ 
+-- 
+1.7.6.4
+
diff --git a/kernel.spec b/kernel.spec
index 724990c..0c20733 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -42,7 +42,7 @@ Summary: The Linux kernel
 # When changing real_sublevel below, reset this by hand to 1
 # (or to 0 and then use rpmdev-bumpspec).
 #
-%global baserelease 1
+%global baserelease 2
 %global fedora_build %{baserelease}
 
 # real_sublevel is the 3.x kernel version we're starting with
@@ -702,6 +702,9 @@ Patch21017: binfmt_elf-fix-PIE-execution-with-random-disabled.patch
 #rhbz #722509
 Patch21018: mmc-Always-check-for-lower-base-frequency-quirk-for-.patch
 
+#rhbz #745241
+Patch21019: fuse-fix-memory-leak.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1273,6 +1276,9 @@ ApplyPatch binfmt_elf-fix-PIE-execution-with-random-disabled.patch
 #rhbz #722509
 ApplyPatch mmc-Always-check-for-lower-base-frequency-quirk-for-.patch
 
+#rhbz #745241
+ApplyPatch fuse-fix-memory-leak.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -1893,6 +1899,9 @@ fi
 # and build.
 
 %changelog
+* Tue Oct 11 2011 Josh Boyer <jwboyer at redhat.com>
+- fix memory leak in fuse (rhbz 745241)
+
 * Tue Oct 11 2011 Dave Jones <davej at redhat.com>
 - add e1000e workaround for packet drop on 82579 at 100Mbps (rhbz 713315)
 


More information about the scm-commits mailing list