[PATCH] erofs: fix double free of 'copied'

Chao Yu chao at kernel.org
Wed Aug 25 22:16:31 AEST 2021


On 2021/8/25 20:07, Gao Xiang wrote:
> Dan reported a new smatch warning [1]
> "fs/erofs/inode.c:210 erofs_read_inode() error: double free of 'copied'"
> 
> Due to new chunk-based format handling logic, the error path can be
> called after kfree(copied).
> 
> Set "copied = NULL" after kfree(copied) to fix this.
> 
> [1] https://lore.kernel.org/r/202108251030.bELQozR7-lkp@intel.com
> Fixes: c5aa903a59db ("erofs: support reading chunk-based uncompressed files")
> Reported-by: kernel test robot <lkp at intel.com>
> Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
> Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>

Reviewed-by: Chao Yu <chao at kernel.org>

Thanks,


More information about the Linux-erofs mailing list