Skip to contentSkip to conversation

fs/squashfs: NULL dereference in sqfs_closedir()

PATCH New Heinrich Schuchardt 2 participants 2 messages Feb 1, 2021 – Feb 25, 2021 SquashFS file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/squashfs: NULL dereference in sqfs_closedir()

sqfs_opendir() called in sqfs_size(), sqfs_read(), sqfs_exists() may fail leading to sqfs_closedir(NULL) being called. Do not dereference NULL.

---
 fs/squashfs/sqfs.c | 3 +++
 1 file changed, 3 insertions(+)
fs/squashfs/sqfs.c +3 -0
index dca13bd1f1..29805c3c6f 100644
@@ -1716,6 +1716,9 @@ void sqfs_closedir(struct fs_dir_stream *dirs)
 {
 	struct squashfs_dir_stream *sqfs_dirs;
 
+	if (!dirs)
+		return;
+
 	sqfs_dirs = (struct squashfs_dir_stream *)dirs;
 	free(sqfs_dirs->inode_table);
 	free(sqfs_dirs->dir_table);

--
2.29.2

#1 lore raw

PATCH 1/1 fs/squashfs: NULL dereference in sqfs_closedir()

Quoted 4 lines · Heinrich Schuchardt

sqfs_opendir() called in sqfs_size(), sqfs_read(), sqfs_exists() may fail leading to sqfs_closedir(NULL) being called. Do not dereference NULL.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210225/e53fae60/attachment.sig>