[PATCH] exofs: don't leak io_state and pages on read error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux