diff options
author | Kevin Cernekee <cernekee@gmail.com> | 2009-09-19 07:18:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-22 17:00:07 -0400 |
commit | 051b982bcc620695de629d29c333c95b66e9b95e (patch) | |
tree | 907229a896c19440e0a046b54fd6823a75ccabee /drivers/net/usb | |
parent | 6f41d12bab6e5ce317b0494f5b3cd0b60e14ebc3 (diff) |
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: Kevin Cernekee <cernekee@gmail.com>
Acked-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/kaweth.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c index e2a39b9be96e..e391ef969c28 100644 --- a/drivers/net/usb/kaweth.c +++ b/drivers/net/usb/kaweth.c | |||
@@ -263,6 +263,7 @@ static int kaweth_control(struct kaweth_device *kaweth, | |||
263 | int timeout) | 263 | int timeout) |
264 | { | 264 | { |
265 | struct usb_ctrlrequest *dr; | 265 | struct usb_ctrlrequest *dr; |
266 | int retval; | ||
266 | 267 | ||
267 | dbg("kaweth_control()"); | 268 | dbg("kaweth_control()"); |
268 | 269 | ||
@@ -278,18 +279,21 @@ static int kaweth_control(struct kaweth_device *kaweth, | |||
278 | return -ENOMEM; | 279 | return -ENOMEM; |
279 | } | 280 | } |
280 | 281 | ||
281 | dr->bRequestType= requesttype; | 282 | dr->bRequestType = requesttype; |
282 | dr->bRequest = request; | 283 | dr->bRequest = request; |
283 | dr->wValue = cpu_to_le16(value); | 284 | dr->wValue = cpu_to_le16(value); |
284 | dr->wIndex = cpu_to_le16(index); | 285 | dr->wIndex = cpu_to_le16(index); |
285 | dr->wLength = cpu_to_le16(size); | 286 | dr->wLength = cpu_to_le16(size); |
286 | 287 | ||
287 | return kaweth_internal_control_msg(kaweth->dev, | 288 | retval = kaweth_internal_control_msg(kaweth->dev, |
288 | pipe, | 289 | pipe, |
289 | dr, | 290 | dr, |
290 | data, | 291 | data, |
291 | size, | 292 | size, |
292 | timeout); | 293 | timeout); |
294 | |||
295 | kfree(dr); | ||
296 | return retval; | ||
293 | } | 297 | } |
294 | 298 | ||
295 | /**************************************************************** | 299 | /**************************************************************** |