diff options
author | Chung-Chiang Cheng <shepjeng@gmail.com> | 2021-06-18 15:59:25 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-14 16:56:48 +0200 |
commit | 5f2dfce8d8bc8484f0add19dbedb5d5a077adcdd (patch) | |
tree | be19790411a9edde12ad7b874d25c76a76de0a0b /fs/configfs | |
parent | e30e636447fd6d08908777818dfbc4fcbcd3f66a (diff) | |
download | linux-stable-5f2dfce8d8bc8484f0add19dbedb5d5a077adcdd.tar.gz linux-stable-5f2dfce8d8bc8484f0add19dbedb5d5a077adcdd.tar.bz2 linux-stable-5f2dfce8d8bc8484f0add19dbedb5d5a077adcdd.zip |
configfs: fix memleak in configfs_release_bin_file
[ Upstream commit 3c252b087de08d3cb32468b54a158bd7ad0ae2f7 ]
When reading binary attributes in progress, buffer->bin_buffer is setup in
configfs_read_bin_file() but never freed.
Fixes: 03607ace807b4 ("configfs: implement binary attributes")
Signed-off-by: Chung-Chiang Cheng <cccheng@synology.com>
[hch: move the vfree rather than duplicating it]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/configfs')
-rw-r--r-- | fs/configfs/file.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/configfs/file.c b/fs/configfs/file.c index da8351d1e455..4d0825213116 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c @@ -482,13 +482,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; } |