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: <ae31e0a6-7cea-4f76-824c-d8f5ae97c101@squashfs.org.uk>
Date: Thu, 6 Mar 2025 14:09:40 +0000
From: Phillip Lougher <phillip@...ashfs.org.uk>
To: Zhiyu Zhang <zhiyuzhang999@...il.com>, akpm@...ux-foundation.org
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] squashfs: Fix invalid pointer dereference in
 squashfs_cache_delete



On 06/03/2025 13:28, Zhiyu Zhang wrote:
> When mounting a squashfs fails, squashfs_cache_init() may return an error
> pointer (e.g., -ENOMEM) instead of NULL. However, squashfs_cache_delete()
> only checks for a NULL cache, and attempts to dereference the invalid
> pointer. This leads to a kernel crash (BUG: unable to handle kernel paging
> request in squashfs_cache_delete).
> 
> This patch fixes the issue by checking IS_ERR(cache) before accessing it.
> 
> Fixes: 49ff29240ebb ("squashfs: make squashfs_cache_init() return ERR_PTR(-ENOMEM)")
> Reported-by: Zhiyu Zhang <zhiyuzhang999@...il.com>
> Closes: https://lore.kernel.org/linux-fsdevel/CALf2hKvaq8B4u5yfrE+BYt7aNguao99mfWxHngA+=o5hwzjdOg@mail.gmail.com/
> Tested-by: Zhiyu Zhang <zhiyuzhang999@...il.com>
> Signed-off-by: Zhiyu Zhang <zhiyuzhang999@...il.com>
> ---
>   fs/squashfs/cache.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/squashfs/cache.c b/fs/squashfs/cache.c
> index 4db0d2b0aab8..181260e72680 100644
> --- a/fs/squashfs/cache.c
> +++ b/fs/squashfs/cache.c
> @@ -198,7 +198,7 @@ void squashfs_cache_delete(struct squashfs_cache *cache)
>   {
>   	int i, j;
>   
> -	if (cache == NULL)
> +	if (IS_ERR(cache) || cache == NULL)
>   		return;
>   
>   	for (i = 0; i < cache->entries; i++) {

Looks good to me.

Reviewed-by: Phillip Lougher <phillip@...ashfs.org.uk>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ