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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ofpgdyoofecqonkq6jqtf4vc3wxulghupbuaw3tuyoj7t7sdoo@tusacuvnwglr>
Date: Fri, 7 Mar 2025 13:03:08 -0500
From: Kent Overstreet <kent.overstreet@...ux.dev>
To: Wentao Liang <vulab@...as.ac.cn>
Cc: linux-bcachefs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bcachefs: Add error handling for bch2_folio()

On Tue, Mar 04, 2025 at 12:03:11PM +0800, Wentao Liang wrote:
> Add error handling for the case where bch2_folio() returns NULL
> in __bch2_folio_set(). Return immediately to prevent null pointer
> dereference.

There is no null ptr deref, this is only called from paths where we
preallocate bch_folio (and there's only two).


> Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
> ---
>  fs/bcachefs/fs-io-pagecache.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/fs/bcachefs/fs-io-pagecache.c b/fs/bcachefs/fs-io-pagecache.c
> index e072900e6a5b..1dc65fef3ff4 100644
> --- a/fs/bcachefs/fs-io-pagecache.c
> +++ b/fs/bcachefs/fs-io-pagecache.c
> @@ -159,6 +159,9 @@ static void __bch2_folio_set(struct folio *folio,
>  	struct bch_folio *s = bch2_folio(folio);
>  	unsigned i, sectors = folio_sectors(folio);
>  
> +	if (!s)
> +		return;
> +
>  	BUG_ON(pg_offset >= sectors);
>  	BUG_ON(pg_offset + pg_len > sectors);
>  
> -- 
> 2.42.0.windows.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ