mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
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: 03607ace80 ("configfs: implement binary attributes")
Signed-off-by: Chung-Chiang Cheng <[email protected]>
[hch: move the vfree rather than duplicating it]
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
2993c1f9d7
commit
f0acb12b98
1 changed files with 5 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue