Skip to content

Commit 5f2dfce

Browse files
shepjenggregkh
authored andcommitted
configfs: fix memleak in configfs_release_bin_file
[ Upstream commit 3c252b0 ] When reading binary attributes in progress, buffer->bin_buffer is setup in configfs_read_bin_file() but never freed. Fixes: 03607ac ("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>
1 parent e30e636 commit 5f2dfce

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎fs/configfs/file.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,13 +482,13 @@ static int configfs_release_bin_file(struct inode *inode, struct file *file)
482482
buffer->bin_buffer_size);
483483
}
484484
up_read(&frag->frag_sem);
485-
/* vfree on NULL is safe */
486-
vfree(buffer->bin_buffer);
487-
buffer->bin_buffer = NULL;
488-
buffer->bin_buffer_size = 0;
489-
buffer->needs_read_fill = 1;
490485
}
491486

487+
vfree(buffer->bin_buffer);
488+
buffer->bin_buffer = NULL;
489+
buffer->bin_buffer_size = 0;
490+
buffer->needs_read_fill = 1;
491+
492492
configfs_release(inode, file);
493493
return 0;
494494
}

0 commit comments

Comments
 (0)