From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vyacheslav Dubeyko Subject: Re: [PATCH] hfsplus: release bnode pages after use, not before Date: Mon, 08 Jun 2015 08:45:09 -0700 Message-ID: <1433778309.2513.11.camel@ubuntu-slavad-14.04> References: <1433637776-3559-1-git-send-email-saproj@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, Sasha Levin , Anton Altaparmakov , Al Viro , Christoph Hellwig , Andrew Morton , Hin-Tak Leung , Sougata Santra To: Sergei Antonov Return-path: Received: from mail-qc0-f180.google.com ([209.85.216.180]:33558 "EHLO mail-qc0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751075AbbFHPpO (ORCPT ); Mon, 8 Jun 2015 11:45:14 -0400 Received: by qcnj1 with SMTP id j1so25984678qcn.0 for ; Mon, 08 Jun 2015 08:45:13 -0700 (PDT) In-Reply-To: <1433637776-3559-1-git-send-email-saproj@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sun, 2015-06-07 at 02:42 +0200, Sergei Antonov wrote: > Fix this bugreport by Sasha Levin: > http://lkml.org/lkml/2015/2/20/85 ("use after free") > Make sure mapped pages are available for the entire lifetime of hfs_bnode. > Sorry, I missed the point. What do you try to fix? How this change fixes the issue? I think that maybe this fix makes sense. But it needs to describe it more deeply. Could you describe the fix with more details? Thanks, Vyacheslav Dubeyko. > Cc: Anton Altaparmakov > Cc: Al Viro > Cc: Christoph Hellwig > Cc: Andrew Morton > Cc: Vyacheslav Dubeyko > Cc: Hin-Tak Leung > Cc: Sougata Santra > Reported-by: Sasha Levin > Signed-off-by: Sergei Antonov > --- > fs/hfsplus/bnode.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c > index 759708f..5af50fb 100644 > --- a/fs/hfsplus/bnode.c > +++ b/fs/hfsplus/bnode.c > @@ -454,7 +454,6 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) > page_cache_release(page); > goto fail; > } > - page_cache_release(page); > node->page[i] = page; > } > > @@ -566,13 +565,12 @@ node_error: > > void hfs_bnode_free(struct hfs_bnode *node) > { > -#if 0 > int i; > > - for (i = 0; i < node->tree->pages_per_bnode; i++) > + for (i = 0; i < node->tree->pages_per_bnode; i++) { > if (node->page[i]) > page_cache_release(node->page[i]); > -#endif > + } > kfree(node); > } >