提交 3c252b08 编写于 作者: C Chung-Chiang Cheng 提交者: Christoph Hellwig

configfs: fix memleak in configfs_release_bin_file

When reading binary attributes in progress, buffer->bin_buffer is setup in
configfs_read_bin_file() but never freed.

Fixes: 03607ace ("configfs: implement binary attributes")
Signed-off-by: NChung-Chiang Cheng <cccheng@synology.com>
[hch: move the vfree rather than duplicating it]
Signed-off-by: NChristoph Hellwig <hch@lst.de>
上级 7fe1e79b
......@@ -407,13 +407,13 @@ static int configfs_release_bin_file(struct inode *inode, struct file *file)
buffer->bin_buffer_size);
}
up_read(&frag->frag_sem);
/* vfree on NULL is safe */
vfree(buffer->bin_buffer);
buffer->bin_buffer = NULL;
buffer->bin_buffer_size = 0;
buffer->needs_read_fill = 1;
}
vfree(buffer->bin_buffer);
buffer->bin_buffer = NULL;
buffer->bin_buffer_size = 0;
buffer->needs_read_fill = 1;
configfs_release(inode, file);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册