[PATCH 1/1] fs/squashfs: fix sqfs_read_sblk()

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Tue May 10 21:53:25 CEST 2022


Setting sblk = NULL has no effect on the caller.
We want to set *sblk = NULL if an error occurrs to avoid usage after free.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 fs/squashfs/sqfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index b07c41e911..18cd386abb 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -49,7 +49,7 @@ static int sqfs_read_sblk(struct squashfs_super_block **sblk)
 
 	if (sqfs_disk_read(0, 1, *sblk) != 1) {
 		free(*sblk);
-		sblk = NULL;
+		*sblk = NULL;
 		return -EINVAL;
 	}
 
-- 
2.34.1



More information about the U-Boot mailing list