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

Commit 051b982b authored by Kevin Cernekee's avatar Kevin Cernekee Committed by David S. Miller
Browse files

kaweth: Fix memory leak in kaweth_control()



kaweth_control() never frees the buffer that it allocates for the USB
control message.  Test case:

while :; do ifconfig eth2 down ; ifconfig eth2 up ; done

This is a tiny buffer so it is a slow leak.  If you want to speed up the
process, you can change the allocation size to e.g. 16384 bytes, and it
will consume several megabytes within a few minutes.

Signed-off-by: default avatarKevin Cernekee <cernekee@gmail.com>
Acked-by: default avatarOliver Neukum <oliver@neukum.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6f41d12b
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -263,6 +263,7 @@ static int kaweth_control(struct kaweth_device *kaweth,
			  int timeout)
{
	struct usb_ctrlrequest *dr;
	int retval;

	dbg("kaweth_control()");

@@ -284,12 +285,15 @@ static int kaweth_control(struct kaweth_device *kaweth,
	dr->wIndex = cpu_to_le16(index);
	dr->wLength = cpu_to_le16(size);

	return kaweth_internal_control_msg(kaweth->dev,
	retval = kaweth_internal_control_msg(kaweth->dev,
					     pipe,
					     dr,
					     data,
					     size,
					     timeout);

	kfree(dr);
	return retval;
}

/****************************************************************