VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   35 Branches   59 Tags
author: Chung-Chiang Cheng <shepjeng@gmail.com> 2021-06-18 15:59:25 +0800 committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2021-07-14 17:07:43 +0200 commit: 19a4d95bfaddbce372ae999fa9357317bc5776c3 parent: 2c3bf6723aa594a9e15065220f750c516e1d4f45
Commit Summary:
configfs: fix memleak in configfs_release_bin_file
Diffstat:
1 file changed, 5 insertions, 5 deletions
diff --git a/fs/configfs/file.c b/fs/configfs/file.c
index e26060dae70a..b4b0fbabd62e 100644
--- a/fs/configfs/file.c
+++ b/fs/configfs/file.c
@@ -480,13 +480,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;
 }