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

Commit 5642aab6 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Gerrit - the friendly Code Review server
Browse files

u_bam_dmux: Fix memory leakage issue for RMNET



Currently driver is freeing rx/tx buffers as part of gbam_disconnect()
and then disabling endpoints. This results in requests queued to USB HW
are dequeued with status set to error code and in completion handler,
buffers are moved to rx_skb_idle_list. When unbind happens, driver is
freeing port structure without freeing skb buffers present in
rx_skb_idle_list which leads to memory leakage. Hence fix the issue by
freeing buffers in rx_skb_idle_list before freeing port structure.

Change-Id: Iaa1b0c7eb358d2bc37e37edea01358f8310d8168
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 02cdb2dc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
/* Copyright (c) 2011-2018, 2020, Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2018, 2020-2021, Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -274,7 +274,7 @@ static void gbam_free_rx_skb_idle_list(struct gbam_port *port)
		return;
	d = &port->data_ch;

	gadget = port->port_usb->cdev->gadget;
	gadget = port->gadget;

	while (d->rx_skb_idle.qlen > 0) {
		skb = __skb_dequeue(&d->rx_skb_idle);
@@ -1028,6 +1028,7 @@ static void gbam_port_free(enum bam_dmux_func_type func)
	if (port) {
		platform_driver_unregister(pdrv);

		gbam_free_rx_skb_idle_list(port);
		kfree(port);
		bam_ports[func].port = NULL;
	}