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-next>] [day] [month] [year] [list]
Message-Id: <20211221020347.46021-1-flyingpeng@tencent.com>
Date:   Tue, 21 Dec 2021 10:03:47 +0800
From:   Peng Hao <flyingpenghao@...il.com>
To:     phillip@...ashfs.org.uk
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH]  fs/squashfs: handle possible null pointer

 in squashfs_fill_super:

        msblk->decompressor = supported_squashfs_filesystem(
                        fc,
                        le16_to_cpu(sblk->s_major),
                        le16_to_cpu(sblk->s_minor),
                        le16_to_cpu(sblk->compression));
        if (msblk->decompressor == NULL)
                goto failed_mount;
        ...

failed_mount:
	...
	squashfs_decompressor_destroy(msblk);

in squashfs_decompressor_destroy:
	if (stream) {
        	msblk->decompressor->free(stream->stream);
msblk->decompressor is NULL.

so add a judgment whether a null pointer.

Signed-off-by: Peng Hao <flyingpeng@...cent.com>
---
 fs/squashfs/decompressor_single.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/squashfs/decompressor_single.c b/fs/squashfs/decompressor_single.c
index 4eb3d083d45e..a155452bbc54 100644
--- a/fs/squashfs/decompressor_single.c
+++ b/fs/squashfs/decompressor_single.c
@@ -54,7 +54,8 @@ void squashfs_decompressor_destroy(struct squashfs_sb_info *msblk)
 	struct squashfs_stream *stream = msblk->stream;
 
 	if (stream) {
-		msblk->decompressor->free(stream->stream);
+		if (msblk->decompressor)
+			msblk->decompressor->free(stream->stream);
 		kfree(stream);
 	}
 }
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ