linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Leak in nlmsvc_testlock for async GETFL case
@ 2007-11-29 18:46 Oleg Drokin
  2007-11-29 19:08 ` J. Bruce Fields
  2007-12-03 17:00 ` Felix Blyakher
  0 siblings, 2 replies; 14+ messages in thread
From: Oleg Drokin @ 2007-11-29 18:46 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-fsdevel

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

Hello!

    Per our discussion, I am resending this patch that fixes a leak in  
nlmsvc_testlock.
    It is addition to another leak fixing patch you already have.
    Without the patch, there is a leakage of nlmblock structure  
refcount that holds a
    reference nlmfile structure, that holds a reference to struct  
file, when async GETFL
    is used (-EINPROGRESS return from file_ops->lock()), and also in  
some error cases.

Bye,
     Oleg

[-- Attachment #2: nlmblock-leak_fix-1.diff --]
[-- Type: application/octet-stream, Size: 1043 bytes --]

--- linux-2.6.22.orig/fs/lockd/svclock.c	2007-07-08 19:32:17.000000000 -0400
+++ linux-2.6.22/fs/lockd/svclock.c	2007-11-25 03:09:46.000000000 -0500
@@ -492,7 +498,8 @@
 			block, block->b_flags, block->b_fl);
 		if (block->b_flags & B_TIMED_OUT) {
 			nlmsvc_unlink_block(block);
-			return nlm_lck_denied;
+			ret = nlm_lck_denied;
+                        goto out;
 		}
 		if (block->b_flags & B_GOT_CALLBACK) {
 			if (block->b_fl != NULL
@@ -502,15 +509,19 @@
 			}
 			else {
 				nlmsvc_unlink_block(block);
-				return nlm_granted;
+				ret = nlm_granted;
+                                goto out;
 			}
 		}
-		return nlm_drop_reply;
+		ret = nlm_drop_reply;
+                goto out;
 	}
 
 	error = vfs_test_lock(file->f_file, &lock->fl);
-	if (error == -EINPROGRESS)
-		return nlmsvc_defer_lock_rqst(rqstp, block);
+	if (error == -EINPROGRESS) {
+		ret = nlmsvc_defer_lock_rqst(rqstp, block);
+                goto out;
+        }
 	if (error) {
 		ret = nlm_lck_denied_nolocks;
 		goto out;

[-- Attachment #3: Type: text/plain, Size: 1 bytes --]



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-01-15 18:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-29 18:46 Leak in nlmsvc_testlock for async GETFL case Oleg Drokin
2007-11-29 19:08 ` J. Bruce Fields
2008-01-12  2:57   ` Oleg Drokin
2008-01-14 20:44     ` J. Bruce Fields
2008-01-15  4:26       ` Matthew Wilcox
2008-01-15  4:28         ` file locks: Use wait_event_interruptible_timeout() Matthew Wilcox
2008-01-15 14:48           ` J. Bruce Fields
2008-01-15 15:04             ` Matthew Wilcox
2008-01-15 18:54               ` J. Bruce Fields
2008-01-15  4:29         ` file locks: Split flock_find_conflict out of flock_lock_file Matthew Wilcox
2008-01-15 18:50           ` J. Bruce Fields
2008-01-15 14:42         ` Leak in nlmsvc_testlock for async GETFL case J. Bruce Fields
2007-12-03 17:00 ` Felix Blyakher
2007-12-03 17:49   ` Oleg Drokin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).