lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8894cbfbf360890f5f781035a345b0d70d0d3d3c.camel@ibm.com>
Date: Fri, 3 Oct 2025 21:47:26 +0000
From: Viacheslav Dubeyko <Slava.Dubeyko@....com>
To: "slava@...eyko.com" <slava@...eyko.com>,
        "dan.carpenter@...aro.org"
	<dan.carpenter@...aro.org>
CC: "glaubitz@...sik.fu-berlin.de" <glaubitz@...sik.fu-berlin.de>,
        "frank.li@...o.com" <frank.li@...o.com>,
        "linux-fsdevel@...r.kernel.org"
	<linux-fsdevel@...r.kernel.org>,
        "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org"
	<kernel-janitors@...r.kernel.org>
Subject: Re:  [PATCH] hfs: fix potential use after free in
 hfs_correct_next_unused_CNID()

On Fri, 2025-10-03 at 12:30 +0300, Dan Carpenter wrote:
> This code calls hfs_bnode_put(node) which drops the refcount and then
> dreferences "node" on the next line.  It's only safe to use "node"
> when we're holding a reference so flip these two lines around.
> 
> Fixes: a06ec283e125 ("hfs: add logic of correcting a next unused CNID")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>  fs/hfs/catalog.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
> index caebabb6642f..b80ba40e3877 100644
> --- a/fs/hfs/catalog.c
> +++ b/fs/hfs/catalog.c
> @@ -322,9 +322,9 @@ int hfs_correct_next_unused_CNID(struct super_block *sb, u32 cnid)
>  			}
>  		}
>  
> +		node_id = node->prev;
>  		hfs_bnode_put(node);
>  
> -		node_id = node->prev;
>  	} while (node_id >= leaf_head);
>  
>  	return -ENOENT;

Yeah, makes sense. Good catch. :) I missed this. Thanks a lot for the fix.

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

Thanks,
Slava.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ