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>] [day] [month] [year] [list]
Message-Id: <20250116191149.2288889-1-ingyujang25@gmail.com>
Date: Fri, 17 Jan 2025 04:11:49 +0900
From: Ingyu Jang <ingyujang25@...il.com>
To: phillip@...ashfs.org.uk
Cc: linux-kernel@...r.kernel.org,
	Ingyu Jang <ingyujang25@...il.com>
Subject: [PATCH] squashfs: Fix ambiguity in get_comp_opts() return value handling

The return value of the function get_comp_opts() is
checked using IS_ERR().
However, it can return NULL when squashfs_comp_opts() returns NULL,
causing ambiguity in its return value.
This makes it difficult for the caller to clearly determine whether the
function succeeded or an error occurred.
Additionally, it may cause a NULL pointer dereference.

To address this issue, get_comp_opts() has been modified to always
return an appropriate error code wrapped with ERR_PTR() in case of
failure.
With this change, the caller can reliably distinguish between success
and error cases using IS_ERR().

Signed-off-by: Ingyu Jang <ingyujang25@...il.com>
---
 fs/squashfs/decompressor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/squashfs/decompressor.c b/fs/squashfs/decompressor.c
index a676084be27e..2988f2d4220c 100644
--- a/fs/squashfs/decompressor.c
+++ b/fs/squashfs/decompressor.c
@@ -117,6 +117,8 @@ static void *get_comp_opts(struct super_block *sb, unsigned short flags)
 	}
 
 	comp_opts = squashfs_comp_opts(msblk, buffer, length);
+	if (!comp_opts)
+		comp_opts = ERR_PTR(-EINVAL);
 
 out:
 	kfree(actor);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ