From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boaz Harrosh Subject: [PATCH] exofs: don't leak io_state and pages on read error Date: Fri, 30 Nov 2012 16:26:23 +0200 Message-ID: <50B8C20F.6050208@panasas.com> References: <1353941346-20598-1-git-send-email-idank@tonian.com> <50B8BE60.6090009@panasas.com> <50B8BF8D.8050704@panasas.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: Idan Kedar , To: open-osd Return-path: Received: from natasha.panasas.com ([67.152.220.90]:36278 "EHLO natasha.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758421Ab2K3O0k (ORCPT ); Fri, 30 Nov 2012 09:26:40 -0500 In-Reply-To: <50B8BF8D.8050704@panasas.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 Signed-off-by: Boaz Harrosh --- 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