[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-fsdevel
Subject:    [PATCH] exofs: don't leak io_state and pages on read error
From:       Boaz Harrosh <bharrosh () panasas ! com>
Date:       2012-11-30 14:26:23
Message-ID: 50B8C20F.6050208 () panasas ! com
[Download RAW message or body]


Same bug as fixed by Idan for write_exec was in read_exec.
Fix the io_state leak and pages state on read error.

CC: Idan Kedar <idank@tonian.com>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/exofs/inode.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 8d82624..87f05d9 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -361,11 +361,13 @@ static int read_exec(struct page_collect *pcol)
 	return 0;
 
 err:
-	if (!pcol->read_4_write)
-		_unlock_pcol_pages(pcol, ret, READ);
+	if (!pcol_copy) /* Failed before ownership transfer */
+		pcol_copy = pcol;
 
-	pcol_free(pcol);
+	if (!pcol->read_4_write)
+		_unlock_pcol_pages(pcol_copy, ret, READ);
 
+	pcol_free(pcol_copy);
 	kfree(pcol_copy);
 	return ret;
 }
-- 
1.7.10.2.677.gb6bc67f

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic