diff mbox series

[1/3] hfs: Unmap the page in the "fail_page" label

Message ID 20220809152004.9223-2-fmdefrancesco@gmail.com (mailing list archive)
State New, archived
Headers show
Series hfs: Replace kmap() with kmap_local_page() | expand

Commit Message

Fabio M. De Francesco Aug. 9, 2022, 3:20 p.m. UTC
Several paths within hfs_btree_open() jump to the "fail_page" label
where put_page() is called while the page is still mapped.

Call kunmap() to unmap the page soon before put_page().

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
 fs/hfs/btree.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Viacheslav Dubeyko Aug. 9, 2022, 6:05 p.m. UTC | #1
> On Aug 9, 2022, at 8:20 AM, Fabio M. De Francesco <fmdefrancesco@gmail.com> wrote:
> 
> Several paths within hfs_btree_open() jump to the "fail_page" label
> where put_page() is called while the page is still mapped.
> 
> Call kunmap() to unmap the page soon before put_page().
> 
> Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
> ---
> fs/hfs/btree.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
> index 19017d296173..56c6782436e9 100644
> --- a/fs/hfs/btree.c
> +++ b/fs/hfs/btree.c
> @@ -124,6 +124,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
> 	return tree;
> 
> fail_page:
> +	kunmap(page);
> 	put_page(page);
> free_inode:
> 	tree->inode->i_mapping->a_ops = &hfs_aops;
> -- 
> 2.37.1
> 


Looks good.

Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>

Thanks,
Slava.
diff mbox series

Patch

diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
index 19017d296173..56c6782436e9 100644
--- a/fs/hfs/btree.c
+++ b/fs/hfs/btree.c
@@ -124,6 +124,7 @@  struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
 	return tree;
 
 fail_page:
+	kunmap(page);
 	put_page(page);
 free_inode:
 	tree->inode->i_mapping->a_ops = &hfs_aops;