Commit 3c252b08 authored by Chung-Chiang Cheng's avatar Chung-Chiang Cheng Committed by Christoph Hellwig
Browse files

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: default avatarChung-Chiang Cheng <cccheng@synology.com>
[hch: move the vfree rather than duplicating it]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 7fe1e79b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -407,12 +407,12 @@ 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;
	}

	configfs_release(inode, file);
	return 0;