diff options
author | Andrea della Porta <andrea.porta@suse.com> | 2025-03-02 19:29:31 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-03-05 12:14:31 -0600 |
commit | e22b2d778106256b44e8ed32e6ad7a5d8fff3ebd (patch) | |
tree | 5b023ee391b6bc4d67a6615df3861d6a6a96eaf7 | |
parent | 31378bd6fc909afabee69f425bf663002277eecf (diff) |
fs/squashfs: Fix memory leak in sqfs_size_nest()
In case MAX_SYMLINK_NEST is reached while determining the size
on a symlink node, the function returns immediately.
This would not free the resources after the free_strings: label
causing a memory leak.
Set the ret value and just break out of the switch to fix this.
Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
-rw-r--r-- | fs/squashfs/sqfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 8fac6c6c5a9..7c364686f14 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -1712,7 +1712,8 @@ static int sqfs_size_nest(const char *filename, loff_t *size) case SQFS_LSYMLINK_TYPE: if (++symlinknest == MAX_SYMLINK_NEST) { *size = 0; - return -ELOOP; + ret = -ELOOP; + break; } symlink = (struct squashfs_symlink_inode *)ipos; |