Unverified Commit edb679bf authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11435 cifs: Fix pages leak when cifs_writedata allocate fails in cifs_writedata_direct_alloc()

parents 6d0ee9b0 95621e78
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -2119,12 +2119,17 @@ cifs_writev_complete(struct work_struct *work)
struct cifs_writedata *
cifs_writedata_alloc(unsigned int nr_pages, work_func_t complete)
{
	struct cifs_writedata *wdata = NULL;

	struct page **pages =
		kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS);
	if (pages)
		return cifs_writedata_direct_alloc(pages, complete);
	if (pages) {
		wdata = cifs_writedata_direct_alloc(pages, complete);
		if (!wdata)
			kvfree(pages);
	}

	return NULL;
	return wdata;
}

struct cifs_writedata *