Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bf6adb9 authored by Vladimir Kondratiev's avatar Vladimir Kondratiev Committed by John W. Linville
Browse files

wil6210: fix memory leak in the AP flow



When switching between STA and AP modes, memory allocated for Rx vring leaks
This is because start_ap() allocates Rx vring but stop_ap() do not free it.
Logically, Rx vring is not valid (HW can't use it anymore), so free it in reset()
Also, check double init for Rx vring and bail out with -EINVAL

Signed-off-by: default avatarVladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent fa4a18e7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -343,6 +343,8 @@ int wil_reset(struct wil6210_priv *wil)
	/* TODO: put MAC in reset */
	wil_target_reset(wil);

	wil_rx_fini(wil);

	/* init after reset */
	wil->pending_connect_cid = -1;
	reinit_completion(&wil->wmi_ready);
+5 −0
Original line number Diff line number Diff line
@@ -557,6 +557,11 @@ int wil_rx_init(struct wil6210_priv *wil)
	struct vring *vring = &wil->vring_rx;
	int rc;

	if (vring->va) {
		wil_err(wil, "Rx ring already allocated\n");
		return -EINVAL;
	}

	vring->size = WIL6210_RX_RING_SIZE;
	rc = wil_vring_alloc(wil, vring);
	if (rc)