summaryrefslogtreecommitdiffstats
path: root/fs/configfs/file.c
diff options
context:
space:
mode:
authorChung-Chiang Cheng <shepjeng@gmail.com>2021-06-18 15:59:25 +0800
committerChristoph Hellwig <hch@lst.de>2021-06-22 09:46:26 +0200
commit3c252b087de08d3cb32468b54a158bd7ad0ae2f7 (patch)
tree45ea8e8e0526ebd96ce5028ab1aafe74c00b658b /fs/configfs/file.c
parent7fe1e79b59ba02fb6bdc45d324f88f1ba97d3ab4 (diff)
downloadlinux-3c252b087de08d3cb32468b54a158bd7ad0ae2f7.tar.gz
linux-3c252b087de08d3cb32468b54a158bd7ad0ae2f7.tar.bz2
linux-3c252b087de08d3cb32468b54a158bd7ad0ae2f7.zip
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: 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>
Diffstat (limited to 'fs/configfs/file.c')
-rw-r--r--fs/configfs/file.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index 53913b84383a..396418333513 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -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;
}