diff mbox series

cifs: use kfree in error path of cifs_writedata_alloc()

Message ID 20221110111939.135696-1-liujian56@huawei.com (mailing list archive)
State New, archived
Headers show
Series cifs: use kfree in error path of cifs_writedata_alloc() | expand

Commit Message

Liu Jian Nov. 10, 2022, 11:19 a.m. UTC
'pages' is allocated by kcalloc(), which should freed by kfree().

Fixes: 4153d789e299 ("cifs: Fix pages array leak when writedata alloc failed in cifs_writedata_alloc()")
Signed-off-by: Liu Jian <liujian56@huawei.com>
---
 fs/cifs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index cd9698209930..9a250fee673f 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2440,7 +2440,7 @@  cifs_writedata_alloc(unsigned int nr_pages, work_func_t complete)
 	if (pages) {
 		writedata = cifs_writedata_direct_alloc(pages, complete);
 		if (!writedata)
-			kvfree(pages);
+			kfree(pages);
 	}
 
 	return writedata;